bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ls truncates user id, group id


From: Keith Thompson
Subject: ls truncates user id, group id
Date: Wed, 25 Oct 2000 03:55:35 -0700 (PDT)

% ls --version
ls (GNU fileutils) 4.0
% uname -a
SunOS elmak 5.7 Generic_106541-06 sun4u sparc SUNW,Ultra-60
% ls -lG core
 112 -rw-r--r--   1 worksupp   103856 Jul 16 07:24 core
% /bin/ls -lo core
-rw-r--r--   1 worksupport  103856 Jul 16 07:24 core

Note that GNU ls truncates the userid "worksupport" to 8 characters,
while the Solaris /bin/ls shows the entire name.  The same happens with
group names longer than 8 characters.

Here's a suggested (untested!) patch, in "diff -u" format:
========================================================================
--- ls.c.orig   Wed Oct 25 03:53:14 2000
+++ ls.c        Wed Oct 25 03:53:35 2000
@@ -2260,7 +2260,7 @@
 
   user_name = (numeric_ids ? NULL : getuser (f->stat.st_uid));
   if (user_name)
-    sprintf (p, "%-8.8s ", user_name);
+    sprintf (p, "%-8s ", user_name);
   else
     sprintf (p, "%-8u ", (unsigned int) f->stat.st_uid);
   p += strlen (p);
@@ -2269,7 +2269,7 @@
     {
       char *group_name = (numeric_ids ? NULL : getgroup (f->stat.st_gid));
       if (group_name)
-       sprintf (p, "%-8.8s ", group_name);
+       sprintf (p, "%-8s ", group_name);
       else
        sprintf (p, "%-8u ", (unsigned int) f->stat.st_gid);
       p += strlen (p);
========================================================================

-- 
Keith Thompson (The_Other_Keith) address@hidden  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Welcome to the last year of the 20th century.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]