public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] coreutils patch for 'ls -l' of GB files
@ 2004-04-24 15:50 Jason Cooper
  2004-04-24 17:09 ` Daniel Drake
  2004-04-25 13:43 ` Christian Birchinger
  0 siblings, 2 replies; 10+ messages in thread
From: Jason Cooper @ 2004-04-24 15:50 UTC (permalink / raw
  To: gentoo-dev

Well, the directions said to send problems to the gentoo developers
before sending them upstream to the package owners, so I'll toss this
your way :)

I've been doing a lot of work with multi-GB files, and I use the command
'watch -n 3 ls -lR workdir/' while my script is ripping the dvd.  I do
_not_ want human-readable output, eg 'ls -lh' because the files are
different scales, some bytes, some kb, some gb, etc.  

Here is the problem: file sizes with more than eight digits make the
output not line up.  This is because 8 characters minimum is hard coded 
into the ls source.  So I changed the hard coded width to 10.  Here is 
the output before:

################old output##################
total 10504120
-rw-r--r--    1 root     root         1163 Apr 24 10:39 dvd9to5.log
-rw-r--r--    1 root     root     4200529896 Apr 24 10:39 movie.m2v
-rw-r--r--    1 root     root     2040659968 Apr 24 10:42 movie.mpeg
-rw-r--r--    1 root     root     295174144 Apr 24 10:34 ofile.ac3
-rw-r--r--    1 root     root     4219849312 Apr 24 10:34 ofile.m2v


And the output after:

################new output##################
total 12989797
drwxr-xr-x    4 root     root             96 Apr 24 10:47 dvd
-rw-r--r--    1 root     root           1903 Apr 24 10:56 dvd9to5.log
-rw-r--r--    1 root     root     4200529896 Apr 24 10:39 movie.m2v
-rw-r--r--    1 root     root     4585990144 Apr 24 10:47 movie.mpeg
-rw-r--r--    1 root     root      295174144 Apr 24 10:34 ofile.ac3
-rw-r--r--    1 root     root     4219849312 Apr 24 10:34 ofile.m2v


So my question for you guys is this:  Should I submit this to the
coreutils owner?  It's stupid simple, literally a one-line patch.  I'd
make it a command line option, but I think they left it hard-coded for a
reason...  

TIA,

Cooper.

Patch attached.

diff -Nurd coreutils-5.0.91/src/ls.c coreutils-5.0.91.lsgb/src/ls.c
--- coreutils-5.0.91/src/ls.c 2003-07-27 02:33:36.000000000 -0400
+++ coreutils-5.0.91.lsgb/src/ls.c  2004-04-24 11:10:55.313158520 -0400
@@ -3008,7 +3008,7 @@
    are actually positive values that have wrapped around.  */
       size += (f->stat.st_size < 0) * ((uintmax_t) OFF_T_MAX -
OFF_T_MIN + 1);

-      sprintf (p, "%8s ",
+      sprintf (p, "%10s ",
          human_readable (size, hbuf, human_output_opts,
                1, file_output_block_size));
     }


--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-05-03 20:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-24 15:50 [gentoo-dev] coreutils patch for 'ls -l' of GB files Jason Cooper
2004-04-24 17:09 ` Daniel Drake
2004-04-24 21:55   ` Jason Cooper
2004-04-24 21:53     ` Daniel Drake
2004-04-25 23:36     ` Drake Wyrm
2004-04-29  4:54   ` Mike Frysinger
2004-04-29 12:32     ` Jason Cooper
2004-05-03 18:56       ` Mike Frysinger
2004-05-03 20:52         ` Peter Ruskin
2004-04-25 13:43 ` Christian Birchinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox