Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Robert Elz Newsgroups: gnu.bash.bug Subject: Re: How do we intercept file saving or output to stdout directly Date: Thu, 27 Aug 2020 05:26:46 +0700 Lines: 30 Approved: bug-bash@gnu.org Message-ID: References: <20200826121352.GN931@eeg.ccf.org> <1598249852364-0.post@n7.nabble.com> <87a6yinjhl.fsf@hobgoblin.ariadne.com> <6237.1598480806@jinx.noi.kre.to> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1598480844 12452 209.51.188.17 (26 Aug 2020 22:27:24 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Greg Wooledge Envelope-to: bug-bash@gnu.org In-Reply-To: <20200826121352.GN931@eeg.ccf.org> Received-SPF: permerror client-ip=2001:3c8:9009:181::2; envelope-from=kre@munnari.OZ.AU; helo=munnari.OZ.AU X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.399, T_SPF_HELO_PERMERROR=0.01, T_SPF_PERMERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <6237.1598480806@jinx.noi.kre.to> X-Mailman-Original-References: <20200826121352.GN931@eeg.ccf.org> <1598249852364-0.post@n7.nabble.com> <87a6yinjhl.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16820 Date: Wed, 26 Aug 2020 08:13:52 -0400 From: Greg Wooledge Message-ID: <20200826121352.GN931@eeg.ccf.org> | The obvious guess is that it's to "prevent you from accidentally | overwriting a file". That would be what one would normally assume, but Dale didn't show what comes just before the open (this sys call trace is from a different OS, so the format is different) 28469 28469 xkbcomp CALL unlink(0x7f7fffffec7b) 28469 28469 xkbcomp NAMI "/dev/stdout" 28469 28469 xkbcomp RET unlink -1 errno 13 Permission denied 28469 28469 xkbcomp CALL open(0x7f7fffffec7b,0xa01,0x1b6) 28469 28469 xkbcomp NAMI "/dev/stdout" 28469 28469 xkbcomp RET open -1 errno 17 File exists If it was attempting to "prevent you from accidentally overwriting a file" it is unlikely it would be unlinking it (or attempting to) first. (0xa01 == O_EXCL|O_CREAT|O_WRONLY 0x1b6 == 0666). If one were to execute xkbcomp as root (people, please don't) then all of this would probably succeed, and replace /dev/stdout with a regular file containing the xkbcomp output. kre