Skip to content

ls does not print 'l' mode indicator for symbolic links #988

@mknos

Description

@mknos
  • In long-listing mode (-l), the ls command prints the file mode as the first element on each line
  • I created a symlink AP which refers to the file "apply"
  • The GNU version prints "l" prefix on the file mode string but the perl version prints '-'
  • The standards document says the 1st character of the mode-string is the entry-type, and for a symbolic link the entry-type should be "l" ("-" should be printed only for regular files) [1]
  • I also verified that the OpenBSD and Sortix versions of ls print the "l" entry-type
  1. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html
%readlink AP
apply
%ls -l AP # GNU
lrwxrwxrwx 1 x x 5 Mar 14 10:42 AP -> apply
%perl ls -l AP
-rwxr-xr-x   1 x       x            4488 Jan 19 14:25 AP

Metadata

Metadata

Assignees

No one assigned

    Labels

    Program: lsThe ls programStatus: verifiedissue has been verified (is reproducible)Type: bugan existing feature does not work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions