Skip to content

"index out of bounds: the len is 2 but the index is 2" on older systemctl #27

Description

@FinitelyFailed

Hi,

I'm using this crate on a device running Linux (Yocto Dunfel), which run systemctl 244.
Where "systemctl list-unit-files" gives me:

UNIT FILE                              STATE          
-.mount                                generated      
boot.mount                             generated      
data.mount                             generated      
dev-hugepages.mount                    static         
dev-mqueue.mount                       static         
sys-fs-fuse-connections.mount          static         
sys-kernel-config.mount                static         
sys-kernel-debug.mount                 static         
tmp.mount                              static         
var-volatile.mount                     generated      
systemd-ask-password-console.path      static         
systemd-ask-password-wall.path         static         
alsa-restore.service                   static         
alsa-state.service                     static         
apmd.service                           static         
autovt@.service                        enabled             
bluetooth.service                      enabled        
bthelper@.service                      static         
busybox-klogd.service                  enabled        
busybox-syslog.service                 enabled        
console-getty.service                  disabled       
container-getty@.service               static         
containerd.service                     disabled       
crond.service                          enabled        
dbus-org.bluez.service                 enabled        
dbus-org.freedesktop.hostname1.service static         
dbus-org.freedesktop.locale1.service   static         
dbus-org.freedesktop.login1.service    static         
dbus-org.freedesktop.network1.service  enabled        
dbus-org.freedesktop.resolve1.service  enabled        
dbus-org.freedesktop.timedate1.service static         
dbus-org.freedesktop.timesync1.service enabled        
dbus.service                           static         
debug-shell.service                    disabled  

I.e. the third column "VENDOR PRESET" doesn't exist.

So when I run e.g. "systemctl::exists" in my code it panics.

It looks lite this line is the culprit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions