From b18d8b5e5cb466d9e9e5ae051fbd3e61daecb720 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 26 May 2026 07:34:09 +0000 Subject: [PATCH 1/2] Initial plan From eeb1b9c8c2356e19f5f0e714f2f059709eb74f8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 26 May 2026 07:43:09 +0000 Subject: [PATCH 2/2] fix: clear DMFSI_ATTR_DIRECTORY bit for device node entries in _readdir Device nodes are files, not directories. Ensure the DMFSI_ATTR_DIRECTORY bit is never set in entry->attr when returning a device node entry so that Dmod_ReadDirEx correctly reports Dmod_DirEntryType_File instead of Dmod_DirEntryType_Dir. Also initialize dmdrvi_stat_t to zero to avoid using uninitialized memory. Fixes: tab completion appending '/' to device node names in dmell shell. Agent-Logs-Url: https://github.com/choco-technologies/dmdevfs/sessions/7c0e9d52-6e03-439d-b1ff-ba896e68f2ed Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com> --- src/dmdevfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dmdevfs.c b/src/dmdevfs.c index 6c2e9a5..688ba71 100644 --- a/src/dmdevfs.c +++ b/src/dmdevfs.c @@ -707,7 +707,7 @@ dmod_dmfsi_dif_api_declaration( 1.0, dmdevfs, int, _readdir, (dmfsi_context_t ct // Extract basename from the full path for the directory entry read_base_name(driver->path, entry->name, sizeof(entry->name)); - dmdrvi_stat_t stat; + dmdrvi_stat_t stat = {0}; int res = driver_stat(driver, driver->path, &stat); if (res != 0) { @@ -716,7 +716,7 @@ dmod_dmfsi_dif_api_declaration( 1.0, dmdevfs, int, _readdir, (dmfsi_context_t ct } entry->size = stat.size; - entry->attr = stat.mode; + entry->attr = stat.mode & ~DMFSI_ATTR_DIRECTORY; } else {