From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6214 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general,gmane.linux.toybox Subject: Re: Re: faccessat and AT_SYM_NOFOLLOW Date: Mon, 29 Sep 2014 12:40:29 -0400 Message-ID: <20140929164029.GZ23797@brightrain.aerifal.cx> References: <20140925160110.GA25937@brightrain.aerifal.cx> <54283FDD.2030902@landley.net> <20140928212025.GX23797@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1412008869 3769 80.91.229.3 (29 Sep 2014 16:41:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2014 16:41:09 +0000 (UTC) Cc: Rob Landley , musl@lists.openwall.com, toybox@lists.landley.net To: Alexander Monakov Original-X-From: musl-return-6227-gllmg-musl=m.gmane.org@lists.openwall.com Mon Sep 29 18:40:57 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XYe0G-0006ew-KT for gllmg-musl@plane.gmane.org; Mon, 29 Sep 2014 18:40:48 +0200 Original-Received: (qmail 9846 invoked by uid 550); 29 Sep 2014 16:40:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9838 invoked from network); 29 Sep 2014 16:40:47 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:6214 gmane.linux.toybox:1378 Archived-At: On Mon, Sep 29, 2014 at 08:27:19PM +0400, Alexander Monakov wrote: > Isn't the reason for faccessat call before unlink is that rm without the -f > flag is explicitely specified to ask for confirmation when the file is not > writable? This may be true (it was never stated when I asked about the purpose), but in that case, faccessat still won't give the correct result unless you use AT_EACCESS (which is broken with glibc and very expensive with musl). The right way to achieve this would be to attempt to open the file (or performing some other operation that would check for write access with the correct effective/fs uid/gid) for writing before unlinking it. Rich