bug-fileutils
[Top][All Lists]
Advanced

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

Re: ls -l will truncate the group owner for a file if the group name is


From: Jim Meyering
Subject: Re: ls -l will truncate the group owner for a file if the group name is > 8 characters...
Date: 06 Jun 2001 21:29:28 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.0.104

"Shivageetha C" <address@hidden> wrote:
| I am a software engineer working for Novell.
|
| Interduction to the problem:
| There is a file, with the group owner for the file being systemtest, if I 
execute ls -l for the file, then the group name will be trunkated (i.e. only 
the first 8 characters will be displyed)
|
| The output:
| # ls -l test_file
| -rw-r--r--    1 admin    systemte        0 May 31 16:52 test_file
|
| Can you please let me know how to get the complete group name?

It's not possible with ls from fileutils-4.1, but it will be
fixed for the next release.

You can use GNU find to get the full username and/or group:

  find your-file-or-directory -printf '%u %g\n'

Here's a patch for ls:

Index: ls.c
===================================================================
RCS file: /fetish/fileutils/src/ls.c,v
retrieving revision 1.264
diff -u -p -r1.264 ls.c
--- ls.c        2001/05/24 20:06:21     1.264
+++ ls.c        2001/05/25 20:56:13
@@ -2610,7 +2610,7 @@ print_long_format (const struct fileinfo
     {
       char *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, "%-8lu ", (unsigned long) f->stat.st_uid);
       p += strlen (p);
@@ -2620,7 +2620,7 @@ print_long_format (const struct fileinfo
     {
       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, "%-8lu ", (unsigned long) f->stat.st_gid);
       p += strlen (p);



reply via email to

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