Re: Possible bug.

2005-01-17 Thread Paul Eggert
[EMAIL PROTECTED] (Harley D. Eades III) writes:

 While creating a file to use for debugging parted I used the command
 `head -c 10m /dev/zero  ./gnu' then used `ls -sh ./gnu' to confirm
 the 10m file was created and noticed ls reported it as 11m.

ls -s reports the amount of disk space consumed by the file, which is
typically more than the number of bytes that you see when you read the
file, due to file system overhead.

   Append a size letter to each size, such as `M' for mebibytes.

 There is a typo in `info ls' as you can see above mebibytes, should that be
 megabytes?

No, mebibytes means 2**20 bytes, whereas megabytes means 10**6
bytes.  This is explained in the Block size node of the
documentation; see http://physics.nist.gov/cuu/Units/binary.html.

 /bin/head -c 1m /dev/zero  test
 /bin/ls -sh ./test
 1.1M ./test

Here's what I got; it may help explain things.

$ export LC_ALL=en_US
$ head -c 2m /dev/zero  test
$ ls -shl test
2.1M -rw-r--r--  1 eggert eggert 2.0M 2005-01-17 01:13 test
$ ls -sl --block-size='1 test
2,101,248 -rw-r--r--  1 eggert eggert 2,097,152 2005-01-17 01:13 test


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


more 5.3.0 issues on cygwin

2005-01-17 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

First, a ping on
http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00063.html,
regarding non-portable group names (I have a cygwin box with the primary
group name of Domain Users, which breaks the assumptions of
tests/group-names that group names are space-separated).

Next, another $(EXEEXT) bug was still floating around, this time in
tests/Makefile.am, breaking the tests/help-version script.  I think it
would be easier to make the all_programs.list target of src/Makefile strip
$(EXEEXT) rather than forcing all callers (currently man/Makefile and
tests/Makefile) to do so, hence the attached patch.  This also stops
listing programs twice in the output, when they appear in both
EXTRA_PROGRAMS and in OPTIONAL_BIN_PROGRAMS or DF_PROG.

Finally, here are some trivial changes that have been part of the cygwin
release.  There are other changes in the cygwin install, but they are not
trivial (for example, making cp, mv, and ln smart enough to auto-append
.exe to the target if it was implied from the source name, since cygwin's
stat() on `progname' is designed to work even if the file is really named
`progname.exe').

2005-01-17  Eric Blake  [EMAIL PROTECTED]  (tiny change)

* src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
duplicates.
* man/Makefile.am (all_programs): Revert previous patch; updated
all_programs.list fixes this.
(.x.1): No need to add $(EXEEXT).

2005-01-03  Corinna Vinschen  [EMAIL PROTECTED]  (tiny change)

* src/install.c (strip): Check for .exe here since strip doesn't.
* src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
available.
* src/od.c (OPENMODE): New macro.
(open_next_file): Use OPENMODE in fopen call.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB67nY84KuGfSFAYARAuL1AKCaEDY9WJC64Bs8zm6fYDK76yL+NACggo2D
SCGG2xDjXdlK7+fNNSrqHBw=
=mgTZ
-END PGP SIGNATURE-
Index: man/Makefile.am
===
RCS file: /cvsroot/coreutils/coreutils/man/Makefile.am,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile.am
--- man/Makefile.am 11 Jan 2005 16:51:03 -  1.36
+++ man/Makefile.am 17 Jan 2005 13:09:06 -
@@ -128,10 +128,10 @@ mapped_name = `echo $*|sed 's/install/gi
@rm -f $@
@echo Updating man page $@;   \
mkdir $t;   \
-   (cd $t  $(LN_S) ../../src/$(mapped_name)$(EXEEXT) $*$(EXEEXT)); \
+   (cd $t  $(LN_S) ../../src/$(mapped_name) $*); \
$(PERL) -- $(srcdir)/help2man   \
--include=$(srcdir)/$*.x\
-   --output=$@ $t/$*$(EXEEXT)
+   --output=$@ $t/$*
@chmod a-w $@
@rm -rf $t
 
@@ -155,7 +155,7 @@ check-x-vs-1:
 
 all_programs = \
   (cd ../src  MAKEFLAGS= $(MAKE) -s all_programs.list)   \
-   | sed -e 's,$(EXEEXT)$$,,' | grep -v '\['
+   | grep -v '\['
 
 .PHONY: check-programs-vs-x
 check-programs-vs-x:
Index: src/Makefile.am
===
RCS file: /cvsroot/coreutils/coreutils/src/Makefile.am,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile.am
--- src/Makefile.am 11 Jan 2005 16:50:27 -  1.48
+++ src/Makefile.am 17 Jan 2005 13:09:06 -
@@ -228,7 +228,8 @@ all_programs = \
   $(EXTRA_PROGRAMS)
 
 all_programs.list:
-   @echo $(all_programs) | tr ' ' '\n' | $(ASSORT)
+   @echo $(all_programs) | tr ' ' '\n' | sed -e 's,$(EXEEXT)$$,,' \
+ | $(ASSORT) -u
 
 pm = progs-makefile
 pr = progs-readme
Index: src/system.h
===
RCS file: /cvsroot/coreutils/coreutils/src/system.h,v
retrieving revision 1.98
diff -u -p -r1.98 system.h
--- src/system.h3 Jan 2005 23:43:39 -   1.98
+++ src/system.h17 Jan 2005 13:09:06 -
@@ -337,7 +337,11 @@ initialize_exit_failure (int status)
 #endif
 
 #ifndef ST_NBLOCKSIZE
-# define ST_NBLOCKSIZE 512
+# ifdef S_BLKSIZE
+#  define ST_NBLOCKSIZE S_BLKSIZE
+# else
+#  define ST_NBLOCKSIZE 512
+# endif
 #endif
 
 /* Redirection and wildcarding when done by the utility itself.
Index: src/install.c
===
RCS file: /cvsroot/coreutils/coreutils/src/install.c,v
retrieving revision 1.172
diff -u -p -r1.172 install.c
--- src/install.c   26 Nov 2004 07:39:32 -  1.172
+++ src/install.c   17 Jan 2005 13:09:07 -
@@ -566,6 +566,20 @@ strip (const char *path)
   error (EXIT_FAILURE, errno, _(fork system call failed));
   break;
 case 0:/* Child. */
+#ifdef __CYGWIN__
+  {
+

Re: Test failures in coreutils-5.3.0 on cygwin

2005-01-17 Thread Paul Eggert
Eric Blake [EMAIL PROTECTED] writes:

 http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00063.html

Conceivably this problem could occur on Unix too.  I installed this
patch to work around it (on Unix, anyway) by using group numbers
rather than names.

2005-01-17  Paul Eggert  [EMAIL PROTECTED]

* tests/group-names: Use numeric group ids, not symbolic group names,
since the latter can have shell metacharacters in them (e.g., spaces).
Problem reported by Eric Blake.
* tests/chgrp/basic: Assume groups are numeric, not symbolic.
* tests/chgrp/deref: Likewise.
* tests/chgrp/posix-H: Likewise.
* tests/chgrp/recurse: Likewise.

Index: tests/group-names
===
RCS file: /fetish/cu/tests/group-names,v
retrieving revision 1.3
diff -p -u -r1.3 group-names
--- tests/group-names   23 Jun 2004 15:07:00 -  1.3
+++ tests/group-names   17 Jan 2005 22:37:32 -
@@ -2,7 +2,7 @@
 # Set `groups' to a space-separated list of at least two groups of which
 # the user is a member.
 
-groups=${FETISH_GROUPS-`(id -nG || /usr/xpg4/bin/id -nG) 2/dev/null`}
+groups=${FETISH_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2/dev/null`}
 case $groups in
   *' '*) ;;
   *) cat EOF 12
Index: tests/chgrp/basic
===
RCS file: /fetish/cu/tests/chgrp/basic,v
retrieving revision 1.19
diff -p -u -r1.19 basic
--- tests/chgrp/basic   19 Aug 2004 20:03:48 -  1.19
+++ tests/chgrp/basic   17 Jan 2005 22:37:32 -
@@ -84,7 +84,11 @@ test $VERBOSE = yes  set +x
   chgrp '' f
   ls -c -t f g
 
-) 21 | sed s/\([ :]\)$g1$/\1G1/;s/\([ :]\)$g2$/\1G2/  actual
+) 21 | sed 
+  s/' to .*[^0-9:].*/' to SOMENAME/
+  s/\([ :]\)$g1$/\1G1/
+  s/\([ :]\)$g2$/\1G2/
+  actual
 
 cat \EOF  expected
 changed group of `f' to G1
@@ -92,7 +96,7 @@ changed group of `f' to G2
 ownership of `f' retained
 changed group of `f' to G1
 group of `f' retained as G1
-changed group of `f' to G2
+changed group of `f' to SOMENAME
 changed group of `d/f3' to G2
 changed group of `d' to G2
 changed group of `d/f3' to G1
Index: tests/chgrp/deref
===
RCS file: /fetish/cu/tests/chgrp/deref,v
retrieving revision 1.9
diff -p -u -r1.9 deref
--- tests/chgrp/deref   23 Jun 2004 15:07:04 -  1.9
+++ tests/chgrp/deref   17 Jan 2005 22:37:32 -
@@ -30,7 +30,7 @@ touch f
 ln -s f symlink
 
 chgrp -h $g2 symlink 2 /dev/null
-set _ `ls -l symlink`
+set _ `ls -ln symlink`
 g=$5
 test $g = $g2 || {
   cat EOF 12
@@ -43,25 +43,25 @@ EOF
 fail=0
 
 chgrp $g1 f
-set _ `ls -l f`; g=$5; test $g = $g1 || fail=1
+set _ `ls -ln f`; g=$5; test $g = $g1 || fail=1
 
 chgrp -h $g2 symlink || fail=1
-set _ `ls -l f`; g=$5; test $g = $g1 || fail=1
-set _ `ls -l symlink`; g=$5; test $g = $g2 || fail=1
+set _ `ls -ln f`; g=$5; test $g = $g1 || fail=1
+set _ `ls -ln symlink`; g=$5; test $g = $g2 || fail=1
 
 # This should not change the group of f.
 chgrp -h $g2 symlink || fail=1
-set _ `ls -l f`; g=$5; test $g = $g1 || fail=1
-set _ `ls -l symlink`; g=$5; test $g = $g2 || fail=1
+set _ `ls -ln f`; g=$5; test $g = $g1 || fail=1
+set _ `ls -ln symlink`; g=$5; test $g = $g2 || fail=1
 
 chgrp $g2 f
-set _ `ls -l f`; g=$5; test $g = $g2 || fail=1
+set _ `ls -ln f`; g=$5; test $g = $g2 || fail=1
 
 # This *should* change the group of f.
 # Though note that the diagnostic you'd get with -c is misleading in that
 # it says the `group of `symlink'' has been changed.
 chgrp --dereference $g1 symlink
-set _ `ls -l f`; g=$5; test $g = $g1 || fail=1
-set _ `ls -l symlink`; g=$5; test $g = $g2 || fail=1
+set _ `ls -ln f`; g=$5; test $g = $g1 || fail=1
+set _ `ls -ln symlink`; g=$5; test $g = $g2 || fail=1
 
 (exit $fail); exit $fail
Index: tests/chgrp/posix-H
===
RCS file: /fetish/cu/tests/chgrp/posix-H,v
retrieving revision 1.3
diff -p -u -r1.3 posix-H
--- tests/chgrp/posix-H 8 Jun 2004 15:25:59 -   1.3
+++ tests/chgrp/posix-H 17 Jan 2005 22:37:32 -
@@ -48,7 +48,7 @@ for i in $changed; do
   # Filter out symlinks (entries that end in `s'), since it's not
   # possible to change their group/owner information on some systems.
   case $i in *s) continue;; esac
-  set _ `ls -dg $i`; shift
+  set _ `ls -dgn $i`; shift
   group=$3
   test $group = $g2 || fail=1
 done
@@ -64,7 +64,7 @@ for i in $not_changed; do
   # Filter out symlinks (entries that end in `s'), since it's not
   # possible to change their group/owner information on some systems.
   case $i in *s) continue;; esac
-  set _ `ls -dg $i`; shift
+  set _ `ls -dgn $i`; shift
   group=$3
   test $group = $g1 || fail=1
 done
Index: tests/chgrp/recurse
===
RCS file: /fetish/cu/tests/chgrp/recurse,v
retrieving revision 1.4
diff -p -u -r1.4 recurse
--- tests/chgrp/recurse 23 

Re: more 5.3.0 issues on cygwin

2005-01-17 Thread Jim Meyering
Eric Blake [EMAIL PROTECTED] wrote:
...
 * src/od.c (OPENMODE): New macro.
 (open_next_file): Use OPENMODE in fopen call.
...
 Index: src/od.c
 ===
 RCS file: /cvsroot/coreutils/coreutils/src/od.c,v
 retrieving revision 1.152
 diff -u -p -r1.152 od.c
 --- src/od.c  28 Sep 2004 01:09:03 -  1.152
 +++ src/od.c  17 Jan 2005 13:09:07 -
 @@ -70,6 +70,12 @@ typedef unsigned long long int ulonglong
  typedef unsigned long int ulonglong_t;
  #endif

 +#ifdef O_BINARY
 +# define OPENMODE rb
 +#else
 +# define OPENMODE r
 +#endif
 +
  enum size_spec
{
  NO_SIZE,
 @@ -906,7 +912,7 @@ open_next_file (void)
   }
else
   {
 -   in_stream = fopen (input_filename, r);
 +   in_stream = fopen (input_filename, OPENMODE);
 if (in_stream == NULL)
   {
 error (0, errno, %s, input_filename);

Why is that needed?
od.c already does this:

  SET_BINARY (fileno (in_stream));

where that macro is defined in system.h:

#if O_BINARY
# ifndef __DJGPP__
#  define setmode _setmode
#  define fileno(_fp) _fileno (_fp)
# endif /* not DJGPP */
# define SET_MODE(_f, _m) setmode (_f, _m)
# define SET_BINARY(_f) do {if (!isatty(_f)) setmode (_f, O_BINARY);} while (0)

Maybe those #if directives don't work on your system?


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils