Skip to content

LIST-DIR request on an empty directory returns an IO Error #35

@labomb

Description

@labomb

When attempting to do a LIST-DIR request on an empty directory, nabud returns error $04 (IO Error) if running on a Debian/ubuntu system. I took a quick look at the source and it seems that if only a path is provided without a file pattern, an asterisk is substituted as the pattern. That is sent off to glob(), which returns $03 (no match found), which results in the error. Debug output from a LIST-DIR with path 'tester' (an empty directory) confirms:

DEBUG: nhacp_req_storage_open: [192.168.168.93] nhacp_o_flags 0x0008 -> fileio_o_flags 0x00000080
INFO: stext_file_open: [192.168.168.93] Opening 'tester'
DEBUG: fileio_ops_for_location: location 'tester' got default scheme.
DEBUG: fileio_ops_for_location: location 'tester' is LOCAL.
DEBUG: fileio_open: size=4096 is_directory=T is_writable=T is_seekable=T is_local=T
DEBUG: conn_io_polltimo: [192.168.168.93] next send timeout: 999 ms
DEBUG: adaptor_event_loop: [192.168.168.93] Waiting for NABU.
DEBUG: conn_io_polltimo: [192.168.168.93] No recv deadline, returning INFTIM.
DEBUG: nhacp_request: [192.168.168.93] Got NABU_MSG_NHACP_REQUEST.
DEBUG: conn_io_polltimo: [192.168.168.93] next recv timeout: 999 ms
DEBUG: nhacp_request: [192.168.168.93] Found context for session ID 1.
DEBUG: conn_io_polltimo: [192.168.168.93] next recv timeout: 999 ms
DEBUG: nhacp_request: [192.168.168.93] Receiving 3 byte request.
DEBUG: conn_io_polltimo: [192.168.168.93] next recv timeout: 999 ms
DEBUG: nhacp_process_request: [192.168.168.93] Got NHACP_REQ_LIST_DIR.
DEBUG: fileio_ops_for_location: location '/home/pi/nhdisk/tester' got default scheme.
DEBUG: fileio_ops_for_location: location '/home/pi/nhdisk/tester' is LOCAL.
DEBUG: nhacp_req_list_dir: [192.168.168.93] Pattern for glob: /home/pi/nhdisk/tester/*
DEBUG: nhacp_req_list_dir: [192.168.168.93] glob() returned 3.

Perhaps this is just a Debian thing (a trailing asterisk with an empty dir doesn't seem to mix), but an empty directory probably shouldn't generate an error. Ideally, an empty directory listing like I would expect to see from the command prompt would be returned...

drwxr-xr-x  2 pi pi 4096 Dec 20 12:28 .
drwxr-xr-x 12 pi pi 4096 Dec 20 12:01 ..

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