Skip to content

Incorrect display of group information in larger directories #5

Description

@moderation

It looks like this is the more up to date repo vs. https://tangled.sh/@rockorager.dev/lsr

When listing files in directories that contains > 256 files with lsr --long --time I always end up with one file being shown with the incorrect user and group of root with the wrong size and date. Same result omitting --time.

-rw-r--r-- moderation moderation    5.1 KB 31 May  2008  icon.jpg
-rw-rw-r-- moderation moderation  646.9 KB 22 Oct  2007 󰈤 opera.adr
---------- root       root            0 B  31 Dec  1969  inf70.pdf

The following fixes it for me but not entirely sure on correctness:

diff --git a/src/main.zig b/src/main.zig
index a48bb02..3e522d6 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1047,7 +1047,7 @@ fn onCompletion(io: *ourio.Ring, task: ourio.Task) anyerror!void {

             for (cmd.entries, 0..) |*entry, i| {
                 if (i >= queue_size) {
-                    cmd.entry_idx = i;
+                    cmd.entry_idx = i - 1;
                     break;
                 }
                 const path = try std.fs.path.joinZ(

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