NetBSD Problem Report #44498

From mouse@Sparkle.Rodents-Montreal.ORG  Mon Jan 31 13:31:11 2011
Return-Path: <mouse@Sparkle.Rodents-Montreal.ORG>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 8EC9D63B873
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Jan 2011 13:31:11 +0000 (UTC)
Message-Id: <201101311331.IAA17480@Sparkle.Rodents-Montreal.ORG>
Date: Mon, 31 Jan 2011 08:31:08 -0500 (EST)
From: der Mouse <mouse@Rodents-Montreal.ORG>
Reply-To: mouse@Rodents-Montreal.ORG
To: gnats-bugs@gnats.NetBSD.org
Subject: [dM] tar unnecessarily demands wd name
X-Send-Pr-Version: 3.95

>Number:         44498
>Category:       bin
>Synopsis:       [dM] tar(1) unnecessarily demands that getcwd() work
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 31 13:35:00 +0000 2011
>Closed-Date:    Wed Aug 07 11:45:05 +0000 2024
>Last-Modified:  Wed Aug 07 11:45:05 +0000 2024
>Originator:     der Mouse
>Release:        NetBSD 4.0.1
>Organization:
	Dis-
>Environment:
	Probably any 4.0.1; noticed on
System: NetBSD Draupadi.Rodents-Montreal.ORG 4.0.1 NetBSD 4.0.1 (GEN401) #1: Mon Jan 17 04:14:49 EST 2011 mouse@Draupadi.Rodents-Montreal.ORG:/home/mouse/kbuild/GEN401 i386
Architecture: i386
Machine: i386
	Also seen on a 5.1 machine.
>Description:
	tar(1) demands that it be able to determine its working
	directory.  This is problematic for normal use; it is
	particularly egregious when it happens even for operations such
	as "tar tvf -" that have nothing to do with filesystem access.

	This is a regression as compared to 1.4T; I no longer have
	anything in between to test with.  The same problem appears on
	morden (5.1_STABLE amd64).
>How-To-Repeat:
	% mkdir foo foo/bar
	% chmod 111 foo
	% cd foo/bar
	% tar tvf -
	tar: Cannot get working directory (Permission denied)
	% 

	Notice in particular that tar does not even try to actually
	perform the operation indicated - it doesn't read anything
	before erroring out.
>Fix:
	Unknown.  Isn't our tar a product from elsewhere?  Then this
	probably would need a cluestick applied to the upstream
	maintainers - or for us to switch tar implementations.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse@rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

>Release-Note:

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44498 CVS commit: src/tests/bin/pax
Date: Mon, 5 Aug 2024 03:55:04 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Aug  5 03:55:04 UTC 2024

 Modified Files:
 	src/tests/bin/pax: t_pax.sh

 Log Message:
 tests/bin/pax: Add test for pax list in an ungettable cwd.

 The list operation has no need to touch the file system, so it should
 have no need for open(".") or getcwd() to succeed.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work

 (The PR was filed about tar(1), which is now bsdtar by default, but
 the issue applies to pax(1) too and would continue to apply to tar(1)
 if you set MKBSDTAR=no.)


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/bin/pax/t_pax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44498 CVS commit: src
Date: Mon, 5 Aug 2024 04:05:51 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Aug  5 04:05:51 UTC 2024

 Modified Files:
 	src/bin/pax: pax.c
 	src/tests/bin/pax: t_pax.sh

 Log Message:
 pax(1): Don't require open(".") or getcwd to work for list operation.

 PR 44498: tar(1) unnecessarily demands that getcwd() work


 To generate a diff of this commit:
 cvs rdiff -u -r1.49 -r1.50 src/bin/pax/pax.c
 cvs rdiff -u -r1.3 -r1.4 src/tests/bin/pax/t_pax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 05 Aug 2024 04:14:01 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-9 and pullup-10


From: Mouse <mouse@Rodents-Montreal.ORG>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/44498 CVS commit: src/tests/bin/pax
Date: Mon, 5 Aug 2024 01:22:46 -0400 (EDT)

 >  tests/bin/pax: Add test for pax list in an ungettable cwd.

 >  pax(1): Don't require open(".") or getcwd to work for list
 >  operation.

 While this is good, it fixes only part of the problem.  Using tar
 syntax because I don't know pax's command line enough to write the
 corresponding pax commands, there are plenty of other commands, such as
 "tar cf - ." or "tar xf -", that also have no call to care what their
 current directory is but which refuse to run when getcwd() fails, both
 in a test I just did on 5.2 using a symlink named "tar" to pax and,
 based on jacob.pipkin@icloud.com's recent mail to tech-userlevel, in
 something more recent for at least pax's "tar -tvf -".

 /~\ The ASCII				  Mouse
 \ / Ribbon Campaign
  X  Against HTML		mouse@rodents-montreal.org
 / \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

From: matthew green <mrg@eterna23.net>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, riastradh@NetBSD.org,
    mouse@Rodents-Montreal.ORG
Subject: re: bin/44498 ([dM] tar(1) unnecessarily demands that getcwd() work)
Date: Mon, 05 Aug 2024 15:57:44 +1000

 > State-Changed-From-To: open->needs-pullups
 > State-Changed-By: riastradh@NetBSD.org
 > State-Changed-When: Mon, 05 Aug 2024 04:14:01 +0000
 > State-Changed-Why:
 > fixed in HEAD, needs pullup-9 and pullup-10

 tar in -9 and -10 are bsdtar, not pax-as-tar, so this wouldn't fix a
 bug in tar only in pax itself.


 .mrg.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44498 CVS commit: src/tests/bin/pax
Date: Mon, 5 Aug 2024 06:03:33 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Aug  5 06:03:33 UTC 2024

 Modified Files:
 	src/tests/bin/pax: t_pax.sh

 Log Message:
 tests/bin/pax: Add some more cwd-related test cases.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/tests/bin/pax/t_pax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44498 CVS commit: src
Date: Mon, 5 Aug 2024 06:03:55 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Aug  5 06:03:54 UTC 2024

 Modified Files:
 	src/bin/pax: pax.c
 	src/tests/bin/pax: t_pax.sh

 Log Message:
 pax(1): Only require getcwd if we're reading without --insecure.

 No other paths use the result of getcwd.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.51 src/bin/pax/pax.c
 cvs rdiff -u -r1.6 -r1.7 src/tests/bin/pax/t_pax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Taylor R Campbell <riastradh@NetBSD.org>
To: matthew green <mrg@eterna23.net>
Cc: gnats-bugs@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org, mouse@Rodents-Montreal.ORG
Subject: Re: bin/44498 ([dM] tar(1) unnecessarily demands that getcwd() work)
Date: Mon, 5 Aug 2024 06:05:32 +0000

 > Date: Mon, 05 Aug 2024 15:57:44 +1000
 > from: matthew green <mrg@eterna23.net>
 > 
 > > fixed in HEAD, needs pullup-9 and pullup-10
 > 
 > tar in -9 and -10 are bsdtar, not pax-as-tar, so this wouldn't fix a
 > bug in tar only in pax itself.

 Bug affects pax(1), not just pax-as-tar(1).

State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 05 Aug 2024 14:52:55 +0000
State-Changed-Why:
pullup-9 #1863 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=1863
pullup-10 #776 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=776


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44498 CVS commit: [netbsd-10] src
Date: Wed, 7 Aug 2024 10:52:49 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Aug  7 10:52:49 UTC 2024

 Modified Files:
 	src/bin/pax [netbsd-10]: ar_subs.c buf_subs.c extern.h file_subs.c
 	    ftree.c pax.c
 	src/tests/bin/pax [netbsd-10]: t_pax.sh

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #776):

 	bin/pax/buf_subs.c: revision 1.31
 	tests/bin/pax/t_pax.sh: revision 1.3
 	tests/bin/pax/t_pax.sh: revision 1.4
 	tests/bin/pax/t_pax.sh: revision 1.5
 	tests/bin/pax/t_pax.sh: revision 1.6
 	tests/bin/pax/t_pax.sh: revision 1.7
 	bin/pax/extern.h: revision 1.61
 	bin/pax/pax.c: revision 1.50
 	bin/pax/pax.c: revision 1.51
 	bin/pax/file_subs.c: revision 1.65
 	bin/pax/ftree.c: revision 1.43
 	bin/pax/ar_subs.c: revision 1.58

 pax: exit 0 if stdin filelist is used and empty

 If copying a list of files from stdin, exit zero instead of non-zero
 if there are no files supplied.

 AFAICT, POSIX doesn't require a non-zero an error in this situation,
 since there are no files to not match.

 Fix from PR bin/41736 by Lloyd Parkes.

 pax: don't overwrite destination if -r -w copy fails

 Add more error handling to pax -r -w so that any failure
 during the copy to the temporary file (including a failed flush)
 prevents any existing destination file from being replaced
 with the partial (including possibly empty) temporary file.

 The partial temporary file is removed.  pax still exists non-zero.
 Thanks to Michael van Elst (mlelstv@) for the analysis
 of the problem in the PR.
 Should fix PR misc/33753.

 tests/bin/pax: Add test for pax list in an ungettable cwd.
 The list operation has no need to touch the file system, so it should
 have no need for open(".") or getcwd() to succeed.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work
 (The PR was filed about tar(1), which is now bsdtar by default, but
 the issue applies to pax(1) too and would continue to apply to tar(1)
 if you set MKBSDTAR=no.)
 pax(1): Don't require open(".") or getcwd to work for list operation.

 PR 44498: tar(1) unnecessarily demands that getcwd() work
 tests/bin/pax: Test pax(1) succeeds with empty file list on stdin.

 PR bin/41736: pax reports an error when copying zero files
 tests/bin/pax: Add some more cwd-related test cases.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work
 pax(1): Only require getcwd if we're reading without --insecure.

 No other paths use the result of getcwd.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work


 To generate a diff of this commit:
 cvs rdiff -u -r1.57 -r1.57.2.1 src/bin/pax/ar_subs.c
 cvs rdiff -u -r1.30 -r1.30.2.1 src/bin/pax/buf_subs.c
 cvs rdiff -u -r1.60 -r1.60.6.1 src/bin/pax/extern.h
 cvs rdiff -u -r1.64 -r1.64.10.1 src/bin/pax/file_subs.c
 cvs rdiff -u -r1.42 -r1.42.42.1 src/bin/pax/ftree.c
 cvs rdiff -u -r1.49 -r1.49.10.1 src/bin/pax/pax.c
 cvs rdiff -u -r1.1 -r1.1.44.1 src/tests/bin/pax/t_pax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44498 CVS commit: [netbsd-9] src
Date: Wed, 7 Aug 2024 10:55:30 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Aug  7 10:55:29 UTC 2024

 Modified Files:
 	src/bin/pax [netbsd-9]: ar_subs.c buf_subs.c extern.h file_subs.c
 	    ftree.c pax.c
 	src/tests/bin/pax [netbsd-9]: t_pax.sh

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1863):

 	bin/pax/buf_subs.c: revision 1.31
 	tests/bin/pax/t_pax.sh: revision 1.3
 	tests/bin/pax/t_pax.sh: revision 1.4
 	tests/bin/pax/t_pax.sh: revision 1.5
 	tests/bin/pax/t_pax.sh: revision 1.6
 	tests/bin/pax/t_pax.sh: revision 1.7
 	bin/pax/extern.h: revision 1.61
 	bin/pax/pax.c: revision 1.50
 	bin/pax/pax.c: revision 1.51
 	bin/pax/file_subs.c: revision 1.65
 	bin/pax/ftree.c: revision 1.43
 	bin/pax/ar_subs.c: revision 1.58

 pax: exit 0 if stdin filelist is used and empty

 If copying a list of files from stdin, exit zero instead of non-zero
 if there are no files supplied.

 AFAICT, POSIX doesn't require a non-zero an error in this situation,
 since there are no files to not match.

 Fix from PR bin/41736 by Lloyd Parkes.

 pax: don't overwrite destination if -r -w copy fails

 Add more error handling to pax -r -w so that any failure
 during the copy to the temporary file (including a failed flush)
 prevents any existing destination file from being replaced
 with the partial (including possibly empty) temporary file.

 The partial temporary file is removed.  pax still exists non-zero.
 Thanks to Michael van Elst (mlelstv@) for the analysis
 of the problem in the PR.
 Should fix PR misc/33753.

 tests/bin/pax: Add test for pax list in an ungettable cwd.
 The list operation has no need to touch the file system, so it should
 have no need for open(".") or getcwd() to succeed.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work
 (The PR was filed about tar(1), which is now bsdtar by default, but
 the issue applies to pax(1) too and would continue to apply to tar(1)
 if you set MKBSDTAR=no.)
 pax(1): Don't require open(".") or getcwd to work for list operation.

 PR 44498: tar(1) unnecessarily demands that getcwd() work
 tests/bin/pax: Test pax(1) succeeds with empty file list on stdin.

 PR bin/41736: pax reports an error when copying zero files
 tests/bin/pax: Add some more cwd-related test cases.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work
 pax(1): Only require getcwd if we're reading without --insecure.

 No other paths use the result of getcwd.

 PR bin/44498: tar(1) unnecessarily demands that getcwd() work


 To generate a diff of this commit:
 cvs rdiff -u -r1.56 -r1.56.46.1 src/bin/pax/ar_subs.c
 cvs rdiff -u -r1.29 -r1.29.4.1 src/bin/pax/buf_subs.c
 cvs rdiff -u -r1.59.36.1 -r1.59.36.2 src/bin/pax/extern.h
 cvs rdiff -u -r1.64 -r1.64.2.1 src/bin/pax/file_subs.c
 cvs rdiff -u -r1.42 -r1.42.34.1 src/bin/pax/ftree.c
 cvs rdiff -u -r1.49 -r1.49.2.1 src/bin/pax/pax.c
 cvs rdiff -u -r1.1 -r1.1.36.1 src/tests/bin/pax/t_pax.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 07 Aug 2024 11:45:05 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 9 and 10


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.