From unknown Sat Jun 21 03:31:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48106: bug: touch utility does not handle file create error properly Resent-From: Roland Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 29 Apr 2021 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48106 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 48106@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161972158025982 (code B ref -1); Thu, 29 Apr 2021 18:40:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Apr 2021 18:39:40 +0000 Received: from localhost ([127.0.0.1]:56815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcBZa-0006ky-7E for submit@debbugs.gnu.org; Thu, 29 Apr 2021 14:39:40 -0400 Received: from lists.gnu.org ([209.51.188.17]:36680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcBKY-0006Nn-NS for submit@debbugs.gnu.org; Thu, 29 Apr 2021 14:24:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcBKX-0002Ji-5O for bug-coreutils@gnu.org; Thu, 29 Apr 2021 14:24:06 -0400 Received: from mout.web.de ([217.72.192.78]:42665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcBKF-0004qp-7P for bug-coreutils@gnu.org; Thu, 29 Apr 2021 14:24:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1619720620; bh=WH8mUYiZhl3lFYK8g4DjdNT+SP93kY3KXT+jj2xwmwQ=; h=X-UI-Sender-Class:To:From:Subject:Date; b=VHcLlb8cDw9GYM8cpWsld45mLP9ksvsre8kJd0dGynY5yuIDTC5Bvltpfs6zRllmN 5mGcg+BmP60VoDO9mRVBsrsN1nwAb2Zt2WSgmo5+yZxr8W6dE4rtBSGpE7sdQQ1DuN sDwDckhXIBzMokXsSCMnnOkQRJ0WuqK72IglxkMo= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from Rolands-MacBook-Pro.cybercon.de ([89.0.177.234]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MWi9q-1m4eQe0Bke-00X0oi for ; Thu, 29 Apr 2021 20:23:40 +0200 From: Roland Message-ID: <6b7b5bb0-a03d-51cd-06af-3ae18daa872e@web.de> Date: Thu, 29 Apr 2021 20:23:47 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:y5nKyzZB/hf28mZ4aQmPgYUQvoZT5l6MaGxJs3p6LeIieHuW25H Iu79IuCDutsQzjS8hwoDzOWqid0bPKIjsOkfOI8v/bjIsgUeusBf87ydkjSSiCQAOn2JE57 n5FHqqqSIN1mmW5cP//5Yj8ATgZvOEUbzqyGozux/ZUPiUbpHXxG/iaDUNhfG/p4FZoFZYj EB6XU0qqQBg9tKFpSENdg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:LWxE96g9KkA=:TKpoI6ho2XJ1Rk7R+WmSok rGRxISZs16YR3ct4wd5bxlLRg87FjivX1Vk3HfOUyiYPIm7ycsZ/fezEV8Rxp2qV0e68TGrJw Tp9UUcUHVt6r5EMsDhHhcPKb6v+ZZct5V2OMTNzkd2smlEPeEv6hTJa8NHe8OrekEdO7fxVN4 0kG+Y5NS9l2uueZDIReE3j1zMZZrT3j965c7vpQowkfRN4Tu3KFkbaVe5LXLkdTg8M1l+LCyy Ic18x12is/4mXKjDzZLB5woBv7OPgdRxK8FD6xuRPingPgkpLVHgQRjxGY3UYJKGlu+ClSVMU qCEs5aRFbmLDH1z4wwHMQAQvHnKLUxqUBquVypgqtV6A7C8ALtiCzU2LQF5j966oLSYCRkyID FBUBgALhetLS2QagIdB+vClbmnhCVUr38skHtfZSX/vKMIMoK7iCVXfV5rJHZpGWxPME7bX1C RNyesxgS4Gt9mhdAnPUAdyWlUQ5H7MPO5Xd7rCaun10nELHGoo3+wYNhuiOU7i7PNrPgdnNHP 58+2G0mjSZuvw98KkN2qUTtnEO84XX/MVpP2H+yYTuv4ASoKGurSMC3ACWWCORetTRstZvHZW OqLas25TvaaCDGZp9jx+egakb2Yj6SRcrD+HPTZM92sXDvL1EXTLMiGFzmk802Rc5GbTWa6Yf s1gfJXk/m8UtqOkETw3yOzwUdVkzlWQX+vW5Lso1kBR/O+VLcf2XdoRGTAn+uiWq2kCi7GAHT 3vqHPJlyh3f2bIu3pDYePTkh77UTvPeb5l0CSg0mB7PzritrjfNJUE1cE3Yp8LrAePEnYcQ5k pGeaov7uxDfajpSKz7XRn9n9ZysDybZTNaLgKFK14yMOntg0piqK77BKbgUVuuZ3Ruj4uuj7C A+rxumvMksrO3tIa7WAkO+IDmB8G9k6AhUKwTQbMwiyiVPIDkWUj6C+66GT8Td/9eY69t+xQN my2h7TuwVioi8u1WsiOR5nhBeqya3lUhexuHbGznRknKbmcO8Apel/vo/32NfTK6727CTNxOS PkvYAgLPX3OeFAfpxdmHIEOJSx8kP43eeylAHrOhZaKk6qgnOSx+MvQQOX0ohBCkED2iLXnYu J4NiWdMnBrwtBERTdgVerD2dxTelBCT00oOwBIn5fxZOfYJBLWwqUjgd5DUnuIxKxhFUk4GGn 0Qy8U8mWvJqyEuKNYbfhVG+MMS+s+3FqszV9ewJ1dd8x9jdFDh85HQ2m75w0dnK0Hf1mc= Received-SPF: pass client-ip=217.72.192.78; envelope-from=devzero@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Mailman-Approved-At: Thu, 29 Apr 2021 14:39:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) hello, touch utility telling weird error on file creation on a immutable/ro dir. apparently, it does not catch/report the first error (EPERM) but only the second one (ENOENT), when trying to set the time on the non-existing file. regards roland kletzing sysadmin root@s900:/tmp# mkdir /tmp/test root@s900:/tmp# chown 0400 /tmp/test/ root@s900:/tmp# chattr +i /tmp/test root@s900:/tmp# touch /tmp/test/testfile touch: setting times of '/tmp/test/testfile': No such file or directory root@s900:/tmp# strace touch /tmp/test/testfile 2>&1 |grep -i test execve("/usr/bin/touch", ["touch", "/tmp/test/testfile"], 0x7ffe690abb88 /* 19 vars */) =3D 0 openat(AT_FDCWD, "/tmp/test/testfile", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) =3D -1 EPERM (Operation not permitted) utimensat(AT_FDCWD, "/tmp/test/testfile", NULL, 0) =3D -1 ENOENT (No such file or directory) write(2, "setting times of '/tmp/test/test"..., 37setting times of '/tmp/test/testfile') =3D 37 # touch=C2=A0 --version touch (GNU coreutils) 8.30 (on debian 10.9) From unknown Sat Jun 21 03:31:17 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Roland Subject: bug#48106: closed (Re: bug#48106: bug: touch utility does not handle file create error properly) Message-ID: References: <6b7b5bb0-a03d-51cd-06af-3ae18daa872e@web.de> X-Gnu-PR-Message: they-closed 48106 X-Gnu-PR-Package: coreutils Reply-To: 48106@debbugs.gnu.org Date: Sat, 01 May 2021 22:49:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1619909342-24960-1" This is a multi-part message in MIME format... ------------=_1619909342-24960-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #48106: bug: touch utility does not handle file create error properly which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 48106@debbugs.gnu.org. --=20 48106: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D48106 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1619909342-24960-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 48106-done) by debbugs.gnu.org; 1 May 2021 22:48:53 +0000 Received: from localhost ([127.0.0.1]:38830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcyPt-0006UN-Em for submit@debbugs.gnu.org; Sat, 01 May 2021 18:48:53 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:54504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcyPr-0006UD-H6 for 48106-done@debbugs.gnu.org; Sat, 01 May 2021 18:48:52 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 388D716006E; Sat, 1 May 2021 15:48:45 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1QD0YegrUpyg; Sat, 1 May 2021 15:48:44 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EC23B160078; Sat, 1 May 2021 15:48:43 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aEdUigGRcB4v; Sat, 1 May 2021 15:48:43 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A7D2516006E; Sat, 1 May 2021 15:48:43 -0700 (PDT) Subject: Re: bug#48106: bug: touch utility does not handle file create error properly To: Roland References: <6b7b5bb0-a03d-51cd-06af-3ae18daa872e@web.de> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 1 May 2021 15:48:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <6b7b5bb0-a03d-51cd-06af-3ae18daa872e@web.de> Content-Type: multipart/mixed; boundary="------------824C1EAC31732C645BF3D6B1" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 48106-done Cc: 48106-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------824C1EAC31732C645BF3D6B1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for reporting the problem. I installed the attached to fix it. --------------824C1EAC31732C645BF3D6B1 Content-Type: text/x-patch; charset=UTF-8; name="0001-touch-fix-wrong-diagnostic-Bug-48106.patch" Content-Disposition: attachment; filename="0001-touch-fix-wrong-diagnostic-Bug-48106.patch" Content-Transfer-Encoding: quoted-printable >From aaa0f003303ab90778b6b426cd9e5a1f1d137ffc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 1 May 2021 15:19:16 -0700 Subject: [PATCH] touch: fix wrong diagnostic (Bug#48106) MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by Roland (Bug#48106). * src/touch.c (touch): Take more care when deciding whether to use open_errno or utime_errno in the diagnostic. Stop worrying about SunOS 4 (which as part of the problem), as it=E2=80=99s long obsolete. For Solaris 10, verify that EINVAL really means the file was a directory. --- src/touch.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/touch.c b/src/touch.c index 653fd313b..46ddd86bb 100644 --- a/src/touch.c +++ b/src/touch.c @@ -122,7 +122,6 @@ get_reldate (struct timespec *result, static bool touch (char const *file) { - bool ok; int fd =3D -1; int open_errno =3D 0; struct timespec const *t =3D newtime; @@ -134,12 +133,7 @@ touch (char const *file) /* Try to open FILE, creating it if necessary. */ fd =3D fd_reopen (STDIN_FILENO, file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY, MODE_R= W_UGO); - - /* Don't save a copy of errno if it's EISDIR, since that would lea= d - touch to give a bogus diagnostic for e.g., 'touch /' (assuming - we don't own / or have write access to it). On Solaris 5.6, - and probably other systems, it is EINVAL. On SunOS4, it's EPER= M. */ - if (fd =3D=3D -1 && errno !=3D EISDIR && errno !=3D EINVAL && errn= o !=3D EPERM) + if (fd < 0) open_errno =3D errno; } =20 @@ -162,9 +156,10 @@ touch (char const *file) t =3D NULL; } =20 - ok =3D (fdutimensat (fd, AT_FDCWD, (fd =3D=3D STDOUT_FILENO ? NULL : f= ile), t, - (no_dereference && fd =3D=3D -1) ? AT_SYMLINK_NOFOL= LOW : 0) - =3D=3D 0); + char const *file_opt =3D fd =3D=3D STDOUT_FILENO ? NULL : file; + int atflag =3D no_dereference ? AT_SYMLINK_NOFOLLOW : 0; + int utime_errno =3D (fdutimensat (fd, AT_FDCWD, file_opt, t, atflag) =3D= =3D 0 + ? 0 : errno); =20 if (fd =3D=3D STDIN_FILENO) { @@ -177,13 +172,22 @@ touch (char const *file) else if (fd =3D=3D STDOUT_FILENO) { /* Do not diagnose "touch -c - >&-". */ - if (!ok && errno =3D=3D EBADF && no_create) + if (utime_errno =3D=3D EBADF && no_create) return true; } =20 - if (!ok) + if (utime_errno !=3D 0) { - if (open_errno) + /* Don't diagnose with open_errno if FILE is a directory, as that + would give a bogus diagnostic for e.g., 'touch /' (assuming we + don't own / or have write access). On Solaris 10 and probably + other systems, opening a directory like "." fails with EINVAL. + (On SunOS 4 it was EPERM but that's obsolete.) */ + struct stat st; + if (open_errno + && ! (open_errno =3D=3D EISDIR + || (open_errno =3D=3D EINVAL + && stat (file, &st) =3D=3D 0 && S_ISDIR (st.st_mode)= ))) { /* The wording of this diagnostic should cover at least two ca= ses: - the file does not exist, but the parent directory is unwr= itable @@ -193,9 +197,9 @@ touch (char const *file) } else { - if (no_create && errno =3D=3D ENOENT) + if (no_create && utime_errno =3D=3D ENOENT) return true; - error (0, errno, _("setting times of %s"), quoteaf (file)); + error (0, utime_errno, _("setting times of %s"), quoteaf (file= )); } return false; } --=20 2.27.0 --------------824C1EAC31732C645BF3D6B1-- ------------=_1619909342-24960-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Apr 2021 18:39:40 +0000 Received: from localhost ([127.0.0.1]:56815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcBZa-0006ky-7E for submit@debbugs.gnu.org; Thu, 29 Apr 2021 14:39:40 -0400 Received: from lists.gnu.org ([209.51.188.17]:36680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcBKY-0006Nn-NS for submit@debbugs.gnu.org; Thu, 29 Apr 2021 14:24:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcBKX-0002Ji-5O for bug-coreutils@gnu.org; Thu, 29 Apr 2021 14:24:06 -0400 Received: from mout.web.de ([217.72.192.78]:42665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcBKF-0004qp-7P for bug-coreutils@gnu.org; Thu, 29 Apr 2021 14:24:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1619720620; bh=WH8mUYiZhl3lFYK8g4DjdNT+SP93kY3KXT+jj2xwmwQ=; h=X-UI-Sender-Class:To:From:Subject:Date; b=VHcLlb8cDw9GYM8cpWsld45mLP9ksvsre8kJd0dGynY5yuIDTC5Bvltpfs6zRllmN 5mGcg+BmP60VoDO9mRVBsrsN1nwAb2Zt2WSgmo5+yZxr8W6dE4rtBSGpE7sdQQ1DuN sDwDckhXIBzMokXsSCMnnOkQRJ0WuqK72IglxkMo= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from Rolands-MacBook-Pro.cybercon.de ([89.0.177.234]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MWi9q-1m4eQe0Bke-00X0oi for ; Thu, 29 Apr 2021 20:23:40 +0200 To: bug-coreutils@gnu.org From: Roland Subject: bug: touch utility does not handle file create error properly Message-ID: <6b7b5bb0-a03d-51cd-06af-3ae18daa872e@web.de> Date: Thu, 29 Apr 2021 20:23:47 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:y5nKyzZB/hf28mZ4aQmPgYUQvoZT5l6MaGxJs3p6LeIieHuW25H Iu79IuCDutsQzjS8hwoDzOWqid0bPKIjsOkfOI8v/bjIsgUeusBf87ydkjSSiCQAOn2JE57 n5FHqqqSIN1mmW5cP//5Yj8ATgZvOEUbzqyGozux/ZUPiUbpHXxG/iaDUNhfG/p4FZoFZYj EB6XU0qqQBg9tKFpSENdg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:LWxE96g9KkA=:TKpoI6ho2XJ1Rk7R+WmSok rGRxISZs16YR3ct4wd5bxlLRg87FjivX1Vk3HfOUyiYPIm7ycsZ/fezEV8Rxp2qV0e68TGrJw Tp9UUcUHVt6r5EMsDhHhcPKb6v+ZZct5V2OMTNzkd2smlEPeEv6hTJa8NHe8OrekEdO7fxVN4 0kG+Y5NS9l2uueZDIReE3j1zMZZrT3j965c7vpQowkfRN4Tu3KFkbaVe5LXLkdTg8M1l+LCyy Ic18x12is/4mXKjDzZLB5woBv7OPgdRxK8FD6xuRPingPgkpLVHgQRjxGY3UYJKGlu+ClSVMU qCEs5aRFbmLDH1z4wwHMQAQvHnKLUxqUBquVypgqtV6A7C8ALtiCzU2LQF5j966oLSYCRkyID FBUBgALhetLS2QagIdB+vClbmnhCVUr38skHtfZSX/vKMIMoK7iCVXfV5rJHZpGWxPME7bX1C RNyesxgS4Gt9mhdAnPUAdyWlUQ5H7MPO5Xd7rCaun10nELHGoo3+wYNhuiOU7i7PNrPgdnNHP 58+2G0mjSZuvw98KkN2qUTtnEO84XX/MVpP2H+yYTuv4ASoKGurSMC3ACWWCORetTRstZvHZW OqLas25TvaaCDGZp9jx+egakb2Yj6SRcrD+HPTZM92sXDvL1EXTLMiGFzmk802Rc5GbTWa6Yf s1gfJXk/m8UtqOkETw3yOzwUdVkzlWQX+vW5Lso1kBR/O+VLcf2XdoRGTAn+uiWq2kCi7GAHT 3vqHPJlyh3f2bIu3pDYePTkh77UTvPeb5l0CSg0mB7PzritrjfNJUE1cE3Yp8LrAePEnYcQ5k pGeaov7uxDfajpSKz7XRn9n9ZysDybZTNaLgKFK14yMOntg0piqK77BKbgUVuuZ3Ruj4uuj7C A+rxumvMksrO3tIa7WAkO+IDmB8G9k6AhUKwTQbMwiyiVPIDkWUj6C+66GT8Td/9eY69t+xQN my2h7TuwVioi8u1WsiOR5nhBeqya3lUhexuHbGznRknKbmcO8Apel/vo/32NfTK6727CTNxOS PkvYAgLPX3OeFAfpxdmHIEOJSx8kP43eeylAHrOhZaKk6qgnOSx+MvQQOX0ohBCkED2iLXnYu J4NiWdMnBrwtBERTdgVerD2dxTelBCT00oOwBIn5fxZOfYJBLWwqUjgd5DUnuIxKxhFUk4GGn 0Qy8U8mWvJqyEuKNYbfhVG+MMS+s+3FqszV9ewJ1dd8x9jdFDh85HQ2m75w0dnK0Hf1mc= Received-SPF: pass client-ip=217.72.192.78; envelope-from=devzero@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 29 Apr 2021 14:39:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) hello, touch utility telling weird error on file creation on a immutable/ro dir. apparently, it does not catch/report the first error (EPERM) but only the second one (ENOENT), when trying to set the time on the non-existing file. regards roland kletzing sysadmin root@s900:/tmp# mkdir /tmp/test root@s900:/tmp# chown 0400 /tmp/test/ root@s900:/tmp# chattr +i /tmp/test root@s900:/tmp# touch /tmp/test/testfile touch: setting times of '/tmp/test/testfile': No such file or directory root@s900:/tmp# strace touch /tmp/test/testfile 2>&1 |grep -i test execve("/usr/bin/touch", ["touch", "/tmp/test/testfile"], 0x7ffe690abb88 /* 19 vars */) =3D 0 openat(AT_FDCWD, "/tmp/test/testfile", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) =3D -1 EPERM (Operation not permitted) utimensat(AT_FDCWD, "/tmp/test/testfile", NULL, 0) =3D -1 ENOENT (No such file or directory) write(2, "setting times of '/tmp/test/test"..., 37setting times of '/tmp/test/testfile') =3D 37 # touch=C2=A0 --version touch (GNU coreutils) 8.30 (on debian 10.9) ------------=_1619909342-24960-1--