GNU bug report logs - #77640
[platform-testers] new snapshot available: gzip-1.13.56-e549

Previous Next

Package: gzip;

Reported by: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>

Date: Tue, 8 Apr 2025 13:09:01 UTC

Severity: normal

To reply to this bug, email your comments to 77640 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Tue, 08 Apr 2025 13:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Nelson H. F. Beebe" <beebe <at> math.utah.edu>:
New bug report received and forwarded. Copy sent to bug-gzip <at> gnu.org. (Tue, 08 Apr 2025 13:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: platform-testers <at> gnu.org, Jim Meyering <jim <at> meyering.net>,
 beebe <at> math.utah.edu, bug-gzip <at> gnu.org
Subject: Re: [platform-testers] new snapshot available: gzip-1.13.56-e549
Date: Tue, 8 Apr 2025 07:07:45 -0600
Yesterday, I reported this failure for gzip-1.13.56-e549 on
DragonFlyBSD 6.4.0: write-error.

Here is the tests/write-error.log file:

+ initial_cwd_=/local/build/cc/gzip-1.13.56-e549/tests
+ testdir_prefix_
+ printf gt
+ pfx_=gt
+ mktempd_ /local/build/cc/gzip-1.13.56-e549/tests gt-write-error.XXXX
+ destdir_=/local/build/cc/gzip-1.13.56-e549/tests
+ template_=gt-write-error.XXXX
+ MAX_TRIES_=4
+ destdir_slash_=/local/build/cc/gzip-1.13.56-e549/tests/
+ unset TMPDIR
+ d=/local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ :
+ test -d /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ ls -dgo /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ perms='drwx------ 1 0 Apr  7 07:53 /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO'
+ :
+ echo /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ return
+ test_dir_=/local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ cd /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ srcdir=../.
+ builddir=..
+ export srcdir builddir
+ gl_init_sh_nl_='
'
+ IFS=$' \t
'
+ expr 1 + 128
+ eval $'trap \'Exit 129\' 1'
+ trap 'Exit 129' 1
+ expr 2 + 128
+ eval $'trap \'Exit 130\' 2'
+ trap 'Exit 130' 2
+ expr 3 + 128
+ eval $'trap \'Exit 131\' 3'
+ trap 'Exit 131' 3
+ expr 13 + 128
+ eval $'trap \'Exit 141\' 13'
+ trap 'Exit 141' 13
+ expr 15 + 128
+ eval $'trap \'Exit 143\' 15'
+ trap 'Exit 143' 15
+ saved_IFS=$' \t
'
+ IFS=:
+ new_PATH=''
+ IFS=$' \t
'
+ test -d /local/build/cc/gzip-1.13.56-e549/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549
+ IFS=$' \t
'
+ test -d /usr/uumath/bin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin
+ IFS=$' \t
'
+ test -d /usr/uumath/share/bin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin
+ IFS=$' \t
'
+ test -d /usr/local/bin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin
+ IFS=$' \t
'
+ test -d /usr/sbin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin
+ IFS=$' \t
'
+ test -d /usr/bin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin
+ IFS=$' \t
'
+ test -d /bin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin
+ IFS=$' \t
'
+ test -d /sbin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin
+ IFS=$' \t
'
+ test -d /usr/local/etc/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local/etc
+ IFS=$' \t
'
+ test -d /etc/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local/etc:/etc
+ IFS=$' \t
'
+ IFS=$' \t
'
+ test -d /u/sy/beebe/tex/bib/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local/etc:/etc:/u/sy/beebe/tex/bib
+ IFS=$' \t
'
+ test -d /usr/local/sbin/.
+ new_PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local/etc:/etc:/u/sy/beebe/tex/bib:/usr/local/sbin
+ IFS=$' \t
'
+ PATH=/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local/etc:/etc:/u/sy/beebe/tex/bib:/usr/local/sbin
+ export PATH
+ trap remove_tmp_ EXIT
+ path_prepend_ ..
+ test 1 '!=' 0
+ path_dir_=..
+ abs_path_dir_=/local/build/cc/gzip-1.13.56-e549/tests/..
+ PATH=/local/build/cc/gzip-1.13.56-e549/tests/..:/local/build/cc/gzip-1.13.56-e549:/usr/uumath/bin:/usr/uumath/share/bin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:/usr/local/etc:/etc:/u/sy/beebe/tex/bib:/usr/local/sbin
+ create_exe_shims_ /local/build/cc/gzip-1.13.56-e549/tests/..
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ fail=0
+ mkdir d
+ echo
+ chmod a-w d
+ test -w d
+ id -u
+ test 887 '=' 0
+ returns_ 1 gzip d/f
+ fail=1
+ Exit 1
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ :
+ test '' '=' yes
+ cd /local/build/cc/gzip-1.13.56-e549/tests
+ chmod -R u+rwx /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ rm -rf /local/build/cc/gzip-1.13.56-e549/tests/gt-write-error.71nO
+ exit 1
FAIL write-error (exit status: 1)

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                                                          -
- Department of Mathematics, 110 LCB    Internet e-mail: beebe <at> math.utah.edu  -
- 155 S 1400 E RM 233                       beebe <at> acm.org  beebe <at> computer.org -
- Salt Lake City, UT 84112-0090, USA    URL: https://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------




Information forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Tue, 08 Apr 2025 17:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 77640 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: platform-testers <at> gnu.org, 77640 <at> debbugs.gnu.org, jim <at> meyering.net
Subject: Re: bug#77640: [platform-testers] new snapshot available:
 gzip-1.13.56-e549
Date: Tue, 8 Apr 2025 10:51:50 -0700
On 2025-04-08 06:07, Nelson H. F. Beebe wrote:
> + mkdir d
> + echo
> + chmod a-w d
> + test -w d
> + id -u
> + test 887 '=' 0
> + returns_ 1 gzip d/f
> + fail=1

To help debug this problem on DragonFlyBSD 6.4.0, please run the 
following commands in the gzip source directory and tell us what the 
./gzip does:

  mkdir d
  echo >d/f
  chmod a-w d
  ./gzip d/f

Also, does the following patch work around the problem?

diff --git a/tests/write-error b/tests/write-error
index a68043a..8556b28 100755
--- a/tests/write-error
+++ b/tests/write-error
@@ -24,7 +24,7 @@ fail=0
 mkdir d || framework_failure_
 echo > d/f || framework_failure_
 chmod a-w d || framework_failure_
-if test -w d || test `id -u` = 0; then
+if echo > d/e; then
   echo >&2 "$0: being root, skipping this test"
   fail=77
 else





Information forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Tue, 08 Apr 2025 20:50:02 GMT) Full text and rfc822 format available.

Message #11 received at 77640 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: 77640 <at> debbugs.gnu.org
Subject: Re: bug#77640: [platform-testers] new snapshot available:
 gzip-1.13.56-e549
Date: Tue, 8 Apr 2025 13:49:10 -0700
On 2025-04-08 11:43, Nelson H. F. Beebe wrote:
> Here is the requested test on DragonFlyBSD for gzip-1.13.56-e549:
> 
> % cat foo.sh
> #! /bin/sh
> mkdir d
> echo >d/f
> chmod a-w d
> ./gzip d/f
> 
> % ./foo.sh
> gzip: d/f.gz already exists; do you wish to overwrite (y or n)? y
> gzip: d/f.gz: No such file or directory
> 
> I then applied the one-line patch to tests/write-error:
> 
> %  diff ./write-error.org ./write-error
> 27c27,28
> < if test -w d || test `id -u` = 0; then
> ---
>> # if test -w d || test `id -u` = 0; then
>> if echo > d/e; then
> 
> % cd ..
> % make check
> ... PASS reports ...
> PASS: unpack-invalid
> PASS: unpack-valid
> PASS: upper-suffix
> [hangs at this point]
> 
> If I run the script in the tests directory, I get
> 
> %  ./write-error
> ./write-error: cannot create d/e: Permission denied
> [again at this point]

Thanks for the further checking on DragonFlyBSD. My guess about the 
syscall bug was incorrect, unfortunately.

I suspect that openat with O_WRONLY|O_CREAT|O_EXCL isn't working 
correctly if the directory fd points to an unwriteable directory opened 
via O_SEARCH|O_DIRECTORY, and that openat misbehaves by failing with 
errno==EEXIST. If my guess is right, I don't see an easy way for gzip to 
work around the kernel bug.




Information forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Tue, 08 Apr 2025 22:46:02 GMT) Full text and rfc822 format available.

Message #14 received at 77640 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: 77640 <at> debbugs.gnu.org
Subject: Re: bug#77640: [platform-testers] new snapshot available:
 gzip-1.13.56-e549
Date: Tue, 8 Apr 2025 15:45:29 -0700
On 4/8/25 14:16, Nelson H. F. Beebe wrote:
> Thanks for this analysis of the gzip-1.13.56-e549 test failures on
> DragonFlyBSD 6.4.0:
> If you can concoct a small C program that is likely to be runnable
> across a range of systems, then I'll be happy to configurize it, and
> then do tests builds on our test farm.

Since I'm guessing about the bug, it'd likely be more efficient to see 
what system calls the failing gzip is executing, before writing a small 
C program. Please run this:

  mkdir d
  echo >d/f
  chmod a-w d
  LC_ALL=C truss -o gzip.truss ./gzip d/f

and then look at the tail of gzip.truss. Here's what I see in gzip.truss 
on Solaris 10 with bleeding-edge gzip:

lwp_sigmask(SIG_SETMASK, 0x60005003, 0x00000000) = 0xFFBFFEFF [0x0000FFFF]
openat64(3, "f.gz", O_WRONLY|O_CREAT|O_EXCL, 0600) Err#13 EACCES 
[file_dac_write]
lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000) = 0xFFBFFEFF [0x0000FFFF]
fstat64(2, 0xFFBFE9A0)                          = 0
write(2, "\n g z i p :   d / f . g".., 33)      = 33
_exit(1)





Information forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Thu, 10 Apr 2025 07:20:02 GMT) Full text and rfc822 format available.

Message #17 received at 77640 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: 77640 <at> debbugs.gnu.org
Subject: Re: bug#77640: [platform-testers] new snapshot available:
 gzip-1.13.56-e549
Date: Thu, 10 Apr 2025 00:19:12 -0700
[Message part 1 (text/plain, inline)]
On 2025-04-09 05:47, Nelson H. F. Beebe wrote:
> I ran these tests in the gzip-1.13.56-e549 build directory
> on DragonFlyBSD 6.4.0:
> 
> 	mkdir d
> 	echo >d/f
> 	chmod a-w d
> 	env LC_ALL=C truss -o gzip.truss ./gzip d/f
> 
> That last command produces this output;
> 
> 	gzip: d/f.gz already exists; do you wish to overwrite (y or n)? y
> 	gzip: d/f.gz: No such file or directory
> 
> The truss output on this system is not as clear as what the Solaris
> truss produces:
> 
> 	% cat gzip.truss
> 	mmap()						 = 7077888 (0x6c0000)
> 	open("/proc/curproc/mem",0x1,0400033010400)	 = 4 (0x4)
> 	fcntl(0x4,0x2,0x1)				 = 0 (0x0)
> 	ioctl(4,PIOCBIS,0x21)				 = 0 (0x0)
> 	ioctl(4,PIOCSFL,0x1)				 = 0 (0x0)
> 	execve(<missing argument>,<missing argument>,<missing argument>)__sysctl(0x7fffffdfc528,0x2,0x80066e4cc,0x7fffffdfc520,0x0,0x0) = 0 (0x0)
> 	mmap()						 = 4624384 (0x469000)
> 	issetugid()					 = 0 (0x0)
> 	__sysctl(0x7fffffdfb808,0x2,0x7fffffdfb7fc,0x7fffffdfb800,0x0,0x0) = 0 (0x0)
> 	__realpath(0x80045c7fe,0x80046d000,0x400)	 ERR#2 'No such file or directory'
> 	access("/usr/lib/gcc80/libc.so.8",0)		 ERR#2 'No such file or directory'
> 	access("/usr/uumath/lib/libc.so.8",0)		 ERR#2 'No such file or directory'
> 	access("/usr/local/lib/libc.so.8",0)		 ERR#2 'No such file or directory'
> 	open("/var/run/ld-elf.so.hints",0x20000,010)	 = 4 (0x4)
> 	read(0x4,0x7fffffdfc290,0x80)			 = 128 (0x80)
> 	lseek()						 = 128 (0x80)
> 	read(0x4,0x80046b400,0x1fc)			 = 508 (0x1fc)
> 	close(4)					 = 0 (0x0)
> 	access("/lib/libc.so.8",0)			 = 0 (0x0)
> 	open("/lib/libc.so.8",0x20000,010)		 = 4 (0x4)
> 	fstat(4,0x7fffffdfc4b0)				 = 0 (0x0)
> 	mmap()						 = 4657152 (0x471000)
> 	mmap()						 = 6811648 (0x67f000)
> 	mmap()						 = 6811648 (0x67f000)
> 	mmap()						 = 10170368 (0x9b3000)
> 	mmap()						 = 10219520 (0x9bf000)
> 	munmap(0x800471000,0x1000)			 = 0 (0x0)
> 	close(4)					 = 0 (0x0)
> 	__sysctl(0x7fffffdfc5f0,0x2,0x7fffffdfc5e0,0x7fffffdfc5e8,0x0,0x0) = 0 (0x0)
> 	munmap(0x800470000,0x1000)			 = 0 (0x0)
> 	mmap()						 = 4653056 (0x470000)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfc560)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfc580,0x0)		 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfcdb0)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfcdd0,0x0)		 = 0 (0x0)
> 	set_tls_area(0x0,0x7fffffdfce90,0x10)		 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfcde0)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfcdc0,0x0)		 = 0 (0x0)
> 	issetugid()					 = 0 (0x0)
> 	open(0,0x0,03777777767747460)			 = 4 (0x4)
> 	read(0x4,0x8009c06c0,0x40)			 = 64 (0x40)
> 	close(4)					 = 0 (0x0)
> 	open("/dev/lpmap",0x2,00)			 = 4 (0x4)
> 	mmap()						 = 4755456 (0x489000)
> 	close(4)					 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfcda0)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfcdc0,0x0)		 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfcda0)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfce00,0x0)		 = 0 (0x0)
> 	open("d/",0x8000000,00)				 = 4 (0x4)
> 	openat(0x4,0x42e002,0x8104,0x0)			 = 5 (0x5)
> 	fstat(5,0x42a920)				 = 0 (0x0)
> 	mmap()						 = 4820992 (0x499000)
> 	munmap(0x800499000,0x10000)			 = 0 (0x0)
> 	mmap()						 = 4849664 (0x4a0000)
> 	mmap()						 = 4915200 (0x4b0000)
> 	sigaction(SIGINT,0x0,0x7fffffdfcd80)		 = 0 (0x0)
> 	sigaction(SIGHUP,0x0,0x7fffffdfcd80)		 = 0 (0x0)
> 	sigaction(SIGPIPE,0x0,0x7fffffdfcd80)		 = 0 (0x0)
> 	sigaction(SIGTERM,0x0,0x7fffffdfcd80)		 = 0 (0x0)
> 	sigaction(SIGXCPU,0x0,0x7fffffdfcd80)		 = 0 (0x0)
> 	sigaction(SIGXFSZ,0x0,0x7fffffdfcd80)		 = 0 (0x0)
> 	sigaction(SIGINT,0x7fffffdfcd80,0x0)		 = 0 (0x0)
> 	sigaction(SIGHUP,0x7fffffdfcd80,0x0)		 = 0 (0x0)
> 	sigaction(SIGPIPE,0x7fffffdfcd80,0x0)		 = 0 (0x0)
> 	sigaction(SIGTERM,0x7fffffdfcd80,0x0)		 = 0 (0x0)
> 	sigaction(SIGXCPU,0x7fffffdfcd80,0x0)		 = 0 (0x0)
> 	sigaction(SIGXFSZ,0x7fffffdfcd80,0x0)		 = 0 (0x0)
> 	sigprocmask(0x1,0x42a0e0,0x7fffffdfcdc0)	 = 0 (0x0)
> 	openat(0x4,0x49f822,0xa01,0x180)		 ERR#17 'File exists'

Thanks for the info. This seems to be a kernel bug, one I see no easy 
way for gzip to work around. To reproduce the bug, perhaps you can run 
the following shell commands:

  mkdir d
  chmod a-w d
  gcc dfly-openat-bug.c
  ./a.out

where dfly-openat-bug.c is attached. The a.out should succeed, but I 
expect it reports a failure for d/f. This might be a basis for a bug 
report to the DragonflyBSD folks.


> 	sigprocmask(0x3,0x7fffffdfcdc0,0x0)		 = 0 (0x0)
> 	write(2,0x7fffffdfc4c0,28)			 = 28 (0x1c)
> 	ioctl(0,TIOCGETA,0x7fffffdfcd60)		 = 0 (0x0)
> 	write(2,0x7fffffdfc4c0,36)			 = 36 (0x24)
> 	fstat(0,0x7fffffdfcc50)				 = 0 (0x0)
> 	ioctl(0,TIOCGETA,0x7fffffdfccb0)		 = 0 (0x0)
> 	read(0x0,0x8004af000,0x1000)			 = 2 (0x2)
> 	unlink(0x49f820)				 ERR#2 'No such file or directory'
> 	mmap()						 = 4980736 (0x4c0000)
> 	stat("/usr/share/nls/C/libc.cat",0x7fffffdfcc10) ERR#2 'No such file or directory'
> 	stat("/usr/share/nls/libc/C",0x7fffffdfcc10)	 ERR#2 'No such file or directory'
> 	stat("/usr/local/share/nls/C/libc.cat",0x7fffffdfcc10) ERR#2 'No such file or directory'
> 	stat("/usr/local/share/nls/libc/C",0x7fffffdfcc10) ERR#2 'No such file or directory'
> 	mmap()						 = 5046272 (0x4d0000)
> 	write(2,0x7fffffdfc4a0,40)			 = 40 (0x28)
> 	close(5)					 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfccd0)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfcca0,0x0)		 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfcc80)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfcca0,0x0)		 = 0 (0x0)
> 	sigprocmask(0x1,0x80066e380,0x7fffffdfcc80)	 = 0 (0x0)
> 	sigprocmask(0x3,0x7fffffdfccf0,0x0)		 = 0 (0x0)
> 	exit(0x1)					process exit, rval = 256
> 
> The line
> 
> 	openat(0x4,0x49f822,0xa01,0x180)		 ERR#17 'File exists'
> 
> has 0xa01 as the "int flags" argument, and "man openat" says
> 
>      The flags specified are formed by or'ing the following values
>   
>             O_RDONLY        open for reading only
>             O_WRONLY        open for writing only
>             O_RDWR          open for reading and writing
>             O_NONBLOCK      do not block on open
>             O_APPEND        append on each write
>             O_CREAT         create file if it does not exist
>             O_TRUNC         truncate size to 0
>             O_EXCL          error if create and file exists
>             O_SHLOCK        atomically obtain a shared lock
>             O_EXLOCK        atomically obtain an exclusive lock
>             O_DIRECT        eliminate or reduce cache effects
>             O_FSYNC         synchronous writes
>             O_NOFOLLOW      do not follow symlinks
>             O_DIRECTORY     error if file is not a directory
>             O_CLOEXEC       set FD_CLOEXEC upon open
>   
> In <fcntl.h>, I find these O_* flag values:
> 
> #define O_RDONLY        0x0000          /* open for reading only */
> #define O_WRONLY        0x0001          /* open for writing only */
> #define O_RDWR          0x0002          /* open for reading and writing */
> #define O_ACCMODE       0x0003          /* mask for above modes */
> #define O_NONBLOCK      0x0004          /* no delay */
> #define O_APPEND        0x0008          /* set append mode */
> #define O_SHLOCK        0x0010          /* open with shared file lock */
> #define O_EXLOCK        0x0020          /* open with exclusive file lock */
> #define O_ASYNC         0x0040          /* signal pgrp when data ready */
> #define O_FSYNC         0x0080          /* synchronous writes */
> #define O_SYNC          0x0080          /* Same as O_FSYNC, but POSIX */
> #define O_NOFOLLOW      0x0100          /* don't follow symlinks */
> #define O_CREAT         0x0200          /* create if nonexistent */
> #define O_TRUNC         0x0400          /* truncate to zero length */
> #define O_EXCL          0x0800          /* error if already exists */
> #define O_NOCTTY        0x8000          /* don't assign controlling terminal */
> #define O_DIRECT        0x00010000
> #define O_CLOEXEC       0x00020000      /* atomically set FD_CLOEXEC */
> #define O_FBLOCKING     0x00040000      /* force blocking I/O */
> #define O_FNONBLOCKING  0x00080000      /* force non-blocking I/O */
> #define O_FAPPEND       0x00100000      /* force append mode for write */
> #define O_FOFFSET       0x00200000      /* force specific offset */
> #define O_FSYNCWRITE    0x00400000      /* force synchronous write */
> #define O_FASYNCWRITE   0x00800000      /* force asynchronous write */
> #define O_UNUSED24      0x01000000
> #define O_UNUSED25      0x02000000
> #define O_UNUSED26      0x04000000
> #define O_DIRECTORY     0x08000000      /* error if not a directory */
> #define FAPPENDONLY     0x20000000      /* O_APPEND cannot be changed */
> #define O_FMASK         (O_FBLOCKING|O_FNONBLOCKING|O_FAPPEND|O_FOFFSET|\
> #define FAPPEND         O_APPEND        /* kernel/compat */
> #define FASYNC          O_ASYNC         /* kernel/compat */
> #define FFSYNC          O_FSYNC         /* kernel */
> #define FNONBLOCK       O_NONBLOCK      /* kernel */
> #define FNDELAY         O_NONBLOCK      /* compat */
> #define O_NDELAY        O_NONBLOCK      /* compat */
> #define FPOSIXSHM       O_NOFOLLOW
> 
> Thus, 0xa01 should mean O_EXCL | O_CREAT | O_WRONLY, the same flags
> that you got in your Solaris truss report.
> 
> -------------------------------------------------------------------------------
> - Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
> - University of Utah                                                          -
> - Department of Mathematics, 110 LCB    Internet e-mail: beebe <at> math.utah.edu  -
> - 155 S 1400 E RM 233                       beebe <at> acm.org  beebe <at> computer.org -
> - Salt Lake City, UT 84112-0090, USA    URL: https://www.math.utah.edu/~beebe -
> -------------------------------------------------------------------------------
[dfly-openat-bug.c (text/x-csrc, attachment)]

Information forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Thu, 10 Apr 2025 18:17:01 GMT) Full text and rfc822 format available.

Message #20 received at 77640 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: 77640 <at> debbugs.gnu.org
Subject: Re: bug#77640: [platform-testers] new snapshot available:
 gzip-1.13.56-e549
Date: Thu, 10 Apr 2025 11:16:46 -0700
On 4/10/25 09:59, Nelson H. F. Beebe wrote:
> I tried that, and gcc reported that O_SEARCH is unknown, and suggested
> ``did you mean 'O_EXCL'?''.

Oh, I thought DragonflyBSD was like other BSDs. My mistake; 
<https://leaf.dragonflybsd.org/cgi/web-man?command=openat&section=ANY> 
says it has neither O_SEARCH nor O_PATH.

In that case please use O_RDONLY instead of O_SEARCH.


>  I made that change and ran the test:
> 
> 	% gcc dfly-openat-bug-2.c && ./a.out
> 	d/f: File exists
> 
> 	% ls -Rl d
> 	d:
> 	total 0
> 
> The "File exists" report certainly seems like a red herring; one would
> have expected "Directory not writable" or "File cannot be created."

Indeed, if you get the same result with O_RDONLY instead of O_SEARCH 
it's a clear bug, one that gzip cannot work around reliably as far as I 
can see.


> My substitution of O_EXCL may have been incorrect, and I don't find
> O_SEARCH documented in "man openat" on CentOS 7 or Ubuntu 24.
> 
> I can certainly post a note about this on the DragonflyBSD mailing
> list, but will wait until I hear agreement from you.




Information forwarded to bug-gzip <at> gnu.org:
bug#77640; Package gzip. (Fri, 11 Apr 2025 07:55:02 GMT) Full text and rfc822 format available.

Message #23 received at 77640 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Nelson H. F. Beebe" <beebe <at> math.utah.edu>
Cc: 77640 <at> debbugs.gnu.org
Subject: Re: bug#77640: [platform-testers] new snapshot available:
 gzip-1.13.56-e549
Date: Fri, 11 Apr 2025 00:45:15 -0700
On 2025-04-10 15:13, Nelson H. F. Beebe wrote:
> I made this change against the original test file:
> 
> 	%  diff dfly-openat-bug.c dfly-openat-bug-3.c
> 	8c8
> 	<   int dirfd = open ("d/", O_SEARCH | O_DIRECTORY);
> 	---
> 	>   int dirfd = open ("d/", O_RDONLY | O_DIRECTORY);
> 	11c11
> 	<   int fd = openat (dirfd, "f", O_EXCL | O_CREAT | O_WRONLY, 0660);
> 	---
> 

That diff is chopped off; what did line 11 get changed to?


> Here is the test run:
> 
> 	% ls -ldR d
> 	dr-xr-xr-x 1 beebe wheel 0 Apr 10 16:06 d
> 
> 	% gcc dfly-openat-bug-3.c && ./a.out
> 	d/f: Permission denied
> 
> The final message now appears to be accurate, and expected due to the
> directory permissions.

Yes, evidently we didn't fully reproduce the symptoms you reported, 
symptoms that I quoted in <https://bugs.gnu.org/77640#17>. The relevant 
line there is:

>> 	openat(0x4,0x49f822,0xa01,0x180)		 ERR#17 'File exists'

0x180 == 0660 and I assume 0xa01 equals (O_EXCL | O_CREAT | O_WRONLY). 
If so, I don't understand why our attempt to reproduce the bug failed, 
unless it has something to do with a change to line 11 above.


> I'm still unclear about why gzip would need (or want) to be able to
> write into a no-write-access directory in the failing test.
> Explanation?

The test is making sure that gzip outputs a reasonable diagnosic when 
asked to write into an unwriteable directory. Unfortunately this isn't 
happening on DragonflyBSD, evidently due to a kernel bug there.




This bug report was last modified 63 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.