From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: Small bug in touch Resent-From: Rickard Norlander Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 15 Jul 2015 15:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 21065@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.143697254219712 (code B ref -1); Wed, 15 Jul 2015 15:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jul 2015 15:02:22 +0000 Received: from localhost ([127.0.0.1]:50159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOCT-00057r-9O for submit@debbugs.gnu.org; Wed, 15 Jul 2015 11:02:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60930) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFMgX-0002pS-42 for submit@debbugs.gnu.org; Wed, 15 Jul 2015 09:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFMgR-00040U-Ax for submit@debbugs.gnu.org; Wed, 15 Jul 2015 09:25:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFMgR-00040Q-99 for submit@debbugs.gnu.org; Wed, 15 Jul 2015 09:25:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFMgQ-0000X2-EN for bug-coreutils@gnu.org; Wed, 15 Jul 2015 09:25:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFMgK-0003n5-4G for bug-coreutils@gnu.org; Wed, 15 Jul 2015 09:25:10 -0400 Received: from mail-qk0-x22d.google.com ([2607:f8b0:400d:c09::22d]:35494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFMgJ-0003kU-Vh for bug-coreutils@gnu.org; Wed, 15 Jul 2015 09:25:04 -0400 Received: by qkbp125 with SMTP id p125so27696707qkb.2 for ; Wed, 15 Jul 2015 06:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=FVeLIjAE63/UBowmw1IdqeJG48op1VgGDGAlIO0YMSI=; b=lPOXTCpVkCpyBBv6piIvu7gRM2whisrSiAbi3WWvkxP8gW34v0D5i6MizMWkw0iQsR 2z52i+muRlRllVL8EipVaJv83pFp74eGBjOw9tbrDZ01McSUYgElpfePOAoGzmOQEPOz kacHZLAwO2WLp+khkXcGDZjwodNUTNazEL2/v174AJKOjn5oNq42UkjMWCC4HH/8o3dZ dLJPFU4saoH11MA9V97J8SP+WlYwnYnFP9i+S8sal1hZtwAsU5zuoQacmI8qGI/pEjeL 7TR+xkFcQ+JU2/YMcUy2dC6NsxS1qfgu/sHXETf1xUsr2P8d5Avn10a94m/Uglzf447d mQQg== MIME-Version: 1.0 X-Received: by 10.140.233.140 with SMTP id e134mr1402716qhc.63.1436966702363; Wed, 15 Jul 2015 06:25:02 -0700 (PDT) Received: by 10.96.205.164 with HTTP; Wed, 15 Jul 2015 06:25:02 -0700 (PDT) Date: Wed, 15 Jul 2015 15:25:02 +0200 Message-ID: From: Rickard Norlander Content-Type: multipart/alternative; boundary=001a1135d2aed93b11051ae9e179 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Wed, 15 Jul 2015 11:02:19 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) --001a1135d2aed93b11051ae9e179 Content-Type: text/plain; charset=UTF-8 touch version 8.23 Command: $ touch -- '-' Happens: Returns successfully, but no file is created (if file exists, timestamp is not updated) Rickard --001a1135d2aed93b11051ae9e179 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
touch version 8.23

Command:
$ touch --= '-'
Happens:
Returns successfully, but= no file is created (if file exists, timestamp is not updated)

Rickard
--001a1135d2aed93b11051ae9e179-- From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: Small bug in touch References: In-Reply-To: Resent-From: Rickard Norlander Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 15 Jul 2015 15:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 21065@debbugs.gnu.org Received: via spool by 21065-submit@debbugs.gnu.org id=B21065.143697337121067 (code B ref 21065); Wed, 15 Jul 2015 15:17:02 +0000 Received: (at 21065) by debbugs.gnu.org; 15 Jul 2015 15:16:11 +0000 Received: from localhost ([127.0.0.1]:50179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOPr-0005Ti-8N for submit@debbugs.gnu.org; Wed, 15 Jul 2015 11:16:11 -0400 Received: from mail-qk0-f179.google.com ([209.85.220.179]:36036) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOPp-0005TV-4e for 21065@debbugs.gnu.org; Wed, 15 Jul 2015 11:16:09 -0400 Received: by qkdv3 with SMTP id v3so30287739qkd.3 for <21065@debbugs.gnu.org>; Wed, 15 Jul 2015 08:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=mtSQTu36xcd5QpkfRAna+hQpF33aJj4iA2yr4zz2pTY=; b=E9ajTWUDbM9w9W8/Whp4bUDt8zl8xYUu0TWc1KTQJBVvp6DidbDs3VrnWH/3TfPi1a cBriGnWJkjTR1dU4R8HELQSrci7QxIAUYEvyjTaPwnL6WNR9AEcSngB2b/GBcC9Mp401 X35CKxMnjSRU8fSUquxIQNYiiRO/VahlPoe9IbjDboeut0bmO1x8iejZgk9yl/20z+k7 pWFQL7RrJjyUO5dUrnAqwA5g/WRFX//sWvheK+mr0N+sMJqGxAA9niufZrkuidMemhto Ga37RwcdkJ/OzC041H9dsI0D8G3nxdU/6JDO1OsPJPxVrmc7GeJhPuWVBngVZMqfNuG9 l49A== MIME-Version: 1.0 X-Received: by 10.55.50.78 with SMTP id y75mr8777860qky.31.1436973363645; Wed, 15 Jul 2015 08:16:03 -0700 (PDT) Received: by 10.96.205.164 with HTTP; Wed, 15 Jul 2015 08:16:03 -0700 (PDT) Date: Wed, 15 Jul 2015 17:16:03 +0200 Message-ID: From: Rickard Norlander Content-Type: multipart/alternative; boundary=001a11471658e45281051aeb6e03 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -0.7 (/) --001a11471658e45281051aeb6e03 Content-Type: text/plain; charset=UTF-8 On second thought this may be the expected behaviour, but I am not completely sure. Sorry if I wasted your time. Rickard --001a11471658e45281051aeb6e03 Content-Type: text/html; charset=UTF-8
On second thought this may be the expected behaviour, but I am not completely sure. Sorry if I wasted your time.

Rickard
--001a11471658e45281051aeb6e03-- From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: Small bug in touch Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 15 Jul 2015 15:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Rickard Norlander , 21065@debbugs.gnu.org Received: via spool by 21065-submit@debbugs.gnu.org id=B21065.143697364521491 (code B ref 21065); Wed, 15 Jul 2015 15:21:01 +0000 Received: (at 21065) by debbugs.gnu.org; 15 Jul 2015 15:20:45 +0000 Received: from localhost ([127.0.0.1]:50189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOUH-0005aZ-7a for submit@debbugs.gnu.org; Wed, 15 Jul 2015 11:20:45 -0400 Received: from mail2.vodafone.ie ([213.233.128.44]:47491) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOUF-0005aL-JK for 21065@debbugs.gnu.org; Wed, 15 Jul 2015 11:20:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkUOAEl5plVtTfsV/2dsb2JhbABbgkFSHzVpgUGBFU66KoV0AQICgT1MAQEBAQEBgQtBA4NgAQEEI2YLDQsCAgUWCwICCQMCAQIBRQYBDAgBAYguAQi6RoVrkEoBK4EiiiqFDYJogUMFlD2EbY98kBsmg309MgGCSQEBAQ Received: from unknown (HELO localhost.localdomain) ([109.77.251.21]) by mail2.vodafone.ie with ESMTP; 15 Jul 2015 16:20:37 +0100 Message-ID: <55A67A44.9000505@draigBrady.com> Date: Wed, 15 Jul 2015 16:20:36 +0100 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 0.0 (/) On 15/07/15 14:25, Rickard Norlander wrote: > touch version 8.23 > > Command: > $ touch -- '-' > Happens: > Returns successfully, but no file is created (if file exists, timestamp is not updated) That is inconsistent with other platforms, though is documented at the top of the man page, and done on purpose since v5.90 with: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=e3513e1 From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: Small bug in touch Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 15 Jul 2015 15:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady , Rickard Norlander , 21065@debbugs.gnu.org Received: via spool by 21065-submit@debbugs.gnu.org id=B21065.143697543724307 (code B ref 21065); Wed, 15 Jul 2015 15:51:02 +0000 Received: (at 21065) by debbugs.gnu.org; 15 Jul 2015 15:50:37 +0000 Received: from localhost ([127.0.0.1]:50223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOxA-0006Jy-Cp for submit@debbugs.gnu.org; Wed, 15 Jul 2015 11:50:37 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44577) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOx7-0006Jh-Vi for 21065@debbugs.gnu.org; Wed, 15 Jul 2015 11:50:34 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 095AC160194; Wed, 15 Jul 2015 08:50:28 -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 jCzbikt9hYpn; Wed, 15 Jul 2015 08:50:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 174BA1609A2; Wed, 15 Jul 2015 08:50:27 -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 uQLCA19HQoWG; Wed, 15 Jul 2015 08:50:27 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id EC960160194; Wed, 15 Jul 2015 08:50:26 -0700 (PDT) Message-ID: <55A68142.2010200@cs.ucla.edu> Date: Wed, 15 Jul 2015 08:50:26 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 References: <55A67A44.9000505@draigBrady.com> In-Reply-To: <55A67A44.9000505@draigBrady.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -1.4 (-) P=C3=A1draig Brady wrote: > done on purpose since v5.90 with: > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3De351= 3e1 Yes, the intent was that there be a way from the shell to touch a file ev= en when=20 one has only its file descriptor. Although POSIX does not specify the be= havior=20 of 'touch -' so portable scripts can't rely on it, users of GNU 'touch' c= an use=20 it regardless of the underlying platform. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 15 12:36:53 2015 Received: (at control) by debbugs.gnu.org; 15 Jul 2015 16:36:53 +0000 Received: from localhost ([127.0.0.1]:50257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPfw-0007Rp-KG for submit@debbugs.gnu.org; Wed, 15 Jul 2015 12:36:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38144) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPfr-0007RK-KY; Wed, 15 Jul 2015 12:36:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 25E0C374A2A; Wed, 15 Jul 2015 16:36:47 +0000 (UTC) Received: from [10.3.113.107] (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6FFVG2T007107; Wed, 15 Jul 2015 11:31:16 -0400 Subject: Re: bug#21065: Small bug in touch To: Rickard Norlander , 21065-done@debbugs.gnu.org References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <55A67CB9.8050703@redhat.com> Date: Wed, 15 Jul 2015 09:31:05 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="U0rWcIiLjj62De2SRLfGLAn8HLMqmdBkH" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -6.4 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --U0rWcIiLjj62De2SRLfGLAn8HLMqmdBkH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tag 21065 notabug thanks On 07/15/2015 07:25 AM, Rickard Norlander wrote: > touch version 8.23 >=20 > Command: > $ touch -- '-' > Happens: > Returns successfully, but no file is created (if file exists, timestamp= is > not updated) Like many other tools, '-' is special-cased in touch to mean operation on stdin: $ touch --help | grep -A1 ' - ' A FILE argument string of - is handled specially and causes touch to change the times of the file associated with standard output. So you successfully touched stdin (in your case, /dev/tty). If you want to create a file named '-', use 'touch ./-'. See also this FAQ: https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#How-do-I-re= move-files-that-start-with-a-dash_003f --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --U0rWcIiLjj62De2SRLfGLAn8HLMqmdBkH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVpny5AAoJEKeha0olJ0NqPrYH/j+hDxcXCqJM5TKUkEyGEAJq 4DhFkSJghtawg/K0auimoRNBuwaNbPx1OdBooZKWFpOt7RvVOZzc8hC6ZFvOWVxj ugceGMvcXkY7jWSExPUIWtTfvTNA9wJXN/3Ik1ZaU3e5cPNBl2aSDESlk2/Ro+h4 2KfjPnkifdeHqiqdN5vvfY7rTwgbO4SIMZP4+Rm/BMP+jm2ENE+lAt3niJGp6FxM NfBIxMBT7EqTKwNR8ysSZzgPbZ8gmUpZscL5CHH9cIsA1V6Kvl3mSIqfF8nyxtiz 7+bLGfRhpnc6kHAXqWiE8HQz9GSfaWBSGc7INX3C1P34AQqpJW0k0FeNfiKnr+8= =MN6I -----END PGP SIGNATURE----- --U0rWcIiLjj62De2SRLfGLAn8HLMqmdBkH-- From unknown Mon Aug 18 11:25:44 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Rickard Norlander Subject: bug#21065: closed (Re: bug#21065: Small bug in touch) Message-ID: References: <55A67ED8.9060800@redhat.com> X-Gnu-PR-Message: they-closed 21065 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: notabug Reply-To: 21065@debbugs.gnu.org Date: Wed, 15 Jul 2015 16:37:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1436978222-28682-1" This is a multi-part message in MIME format... ------------=_1436978222-28682-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #21065: Small bug in touch 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 21065@debbugs.gnu.org. --=20 21065: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21065 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1436978222-28682-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 21065-done) by debbugs.gnu.org; 15 Jul 2015 16:36:49 +0000 Received: from localhost ([127.0.0.1]:50253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPfs-0007RY-Vb for submit@debbugs.gnu.org; Wed, 15 Jul 2015 12:36:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38054) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPfq-0007RD-EY for 21065-done@debbugs.gnu.org; Wed, 15 Jul 2015 12:36:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B9E2019F253; Wed, 15 Jul 2015 16:36:42 +0000 (UTC) Received: from [10.3.113.107] (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6FFe9kG011401; Wed, 15 Jul 2015 11:40:09 -0400 Subject: Re: bug#21065: Small bug in touch To: Rickard Norlander , 21065-done@debbugs.gnu.org References: <55A67CB9.8050703@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg X-Enigmail-Draft-Status: N1110 Organization: Red Hat, Inc. Message-ID: <55A67ED8.9060800@redhat.com> Date: Wed, 15 Jul 2015 09:40:08 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <55A67CB9.8050703@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="elmIsmdChmSUMpBpPlVdEEpxsfqLnfLGx" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 21065-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -6.4 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --elmIsmdChmSUMpBpPlVdEEpxsfqLnfLGx Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/15/2015 09:31 AM, Eric Blake wrote: > tag 21065 notabug > thanks >=20 > On 07/15/2015 07:25 AM, Rickard Norlander wrote: >> touch version 8.23 >> >> Command: >> $ touch -- '-' >> Happens: >> Returns successfully, but no file is created (if file exists, timestam= p is >> not updated) >=20 > Like many other tools, '-' is special-cased in touch to mean operation > on stdin: Looks like I'm not careful in what I wrote; most utilities treat '-' as stdin, but touch documented... >=20 > $ touch --help | grep -A1 ' - ' > A FILE argument string of - is handled specially and causes touch to > change the times of the file associated with standard output. =2E..that it was affecting stdout. >=20 > So you successfully touched stdin (in your case, /dev/tty). Either way, in your example, since you were using an interactive shell, /dev/tty was still touched, > If you want > to create a file named '-', use 'touch ./-'. and this advice still holds. On a related note, the just-released 8.24 fixed 'tee -' to NOT treat '-' as meaning stdout (which was a violation of POSIX) and to instead treat it as a literal file. Here's what POSIX says: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -. It's not obvious whether 'touch' is opening a file for reading or writing (it doesn't always have to open a file, after all, but if it creates the file it IS opening it even if it doesn't read or write to the file). We changed 'touch -' way back in 5.90, in 2005, when making a bunch of POSIX cleanups, so I guess the argument at the time probably still holds that we are not in violation of that guideline by treating '-' as stdout, even though POSIX does not explicitly describe that behavior in: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --elmIsmdChmSUMpBpPlVdEEpxsfqLnfLGx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVpn7YAAoJEKeha0olJ0NqCHQH/A/3SScCoUip+cpeZIOEnEvC OI27LVCG3JrmDtDyvjXwTqY/6DQ5hHzfm9SUWrrX8kvQEQH5XXG48oXUeE+kjVln 0tinjxgr855p261Ox3qmOMBYCTs1njHtktSZgfSUi1UTikN/7em5K0iDeJZXlEYM O9ca+DMJPgy8E4z5KRFQhTOr3COOOrlR1jMnSBUj/JIgwsfaG9q6J7M4HceXYCrA aPugePCz4SOcHD8h7nbw1cR/y0hK+/8ayvPCGAtnVh2spnHKbKjcS0v4AqHkN1hl 5ZA+GNbs9aYIVRJlZfbMVQhMSETpsr/m8zlig6J5DT2aWMbxTuIVdqhZVxZNEkI= =xEW4 -----END PGP SIGNATURE----- --elmIsmdChmSUMpBpPlVdEEpxsfqLnfLGx-- ------------=_1436978222-28682-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Jul 2015 15:02:22 +0000 Received: from localhost ([127.0.0.1]:50159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFOCT-00057r-9O for submit@debbugs.gnu.org; Wed, 15 Jul 2015 11:02:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60930) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFMgX-0002pS-42 for submit@debbugs.gnu.org; Wed, 15 Jul 2015 09:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFMgR-00040U-Ax for submit@debbugs.gnu.org; Wed, 15 Jul 2015 09:25:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFMgR-00040Q-99 for submit@debbugs.gnu.org; Wed, 15 Jul 2015 09:25:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFMgQ-0000X2-EN for bug-coreutils@gnu.org; Wed, 15 Jul 2015 09:25:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFMgK-0003n5-4G for bug-coreutils@gnu.org; Wed, 15 Jul 2015 09:25:10 -0400 Received: from mail-qk0-x22d.google.com ([2607:f8b0:400d:c09::22d]:35494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFMgJ-0003kU-Vh for bug-coreutils@gnu.org; Wed, 15 Jul 2015 09:25:04 -0400 Received: by qkbp125 with SMTP id p125so27696707qkb.2 for ; Wed, 15 Jul 2015 06:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=FVeLIjAE63/UBowmw1IdqeJG48op1VgGDGAlIO0YMSI=; b=lPOXTCpVkCpyBBv6piIvu7gRM2whisrSiAbi3WWvkxP8gW34v0D5i6MizMWkw0iQsR 2z52i+muRlRllVL8EipVaJv83pFp74eGBjOw9tbrDZ01McSUYgElpfePOAoGzmOQEPOz kacHZLAwO2WLp+khkXcGDZjwodNUTNazEL2/v174AJKOjn5oNq42UkjMWCC4HH/8o3dZ dLJPFU4saoH11MA9V97J8SP+WlYwnYnFP9i+S8sal1hZtwAsU5zuoQacmI8qGI/pEjeL 7TR+xkFcQ+JU2/YMcUy2dC6NsxS1qfgu/sHXETf1xUsr2P8d5Avn10a94m/Uglzf447d mQQg== MIME-Version: 1.0 X-Received: by 10.140.233.140 with SMTP id e134mr1402716qhc.63.1436966702363; Wed, 15 Jul 2015 06:25:02 -0700 (PDT) Received: by 10.96.205.164 with HTTP; Wed, 15 Jul 2015 06:25:02 -0700 (PDT) Date: Wed, 15 Jul 2015 15:25:02 +0200 Message-ID: Subject: Small bug in touch From: Rickard Norlander To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary=001a1135d2aed93b11051ae9e179 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 15 Jul 2015 11:02:19 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) --001a1135d2aed93b11051ae9e179 Content-Type: text/plain; charset=UTF-8 touch version 8.23 Command: $ touch -- '-' Happens: Returns successfully, but no file is created (if file exists, timestamp is not updated) Rickard --001a1135d2aed93b11051ae9e179 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
touch version 8.23

Command:
$ touch --= '-'
Happens:
Returns successfully, but= no file is created (if file exists, timestamp is not updated)

Rickard
--001a1135d2aed93b11051ae9e179-- ------------=_1436978222-28682-1-- From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: Small bug in touch Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 15 Jul 2015 16:37:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: 21065-done@debbugs.gnu.org Received: via spool by 21065-done@debbugs.gnu.org id=D21065.143697822028664 (code D ref 21065); Wed, 15 Jul 2015 16:37:03 +0000 Received: (at 21065-done) by debbugs.gnu.org; 15 Jul 2015 16:37:00 +0000 Received: from localhost ([127.0.0.1]:50260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPg3-0007SG-6R for submit@debbugs.gnu.org; Wed, 15 Jul 2015 12:36:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33604) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPg1-0007S8-Jo for 21065-done@debbugs.gnu.org; Wed, 15 Jul 2015 12:36:58 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 339922C770E for <21065-done@debbugs.gnu.org>; Wed, 15 Jul 2015 16:36:57 +0000 (UTC) Received: from [10.3.113.107] (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6FGau93011143 for <21065-done@debbugs.gnu.org>; Wed, 15 Jul 2015 12:36:56 -0400 From: Eric Blake References: <55A67CB9.8050703@redhat.com> Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <55A68C28.1060202@redhat.com> Date: Wed, 15 Jul 2015 10:36:56 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <55A67CB9.8050703@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -6.4 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -6.4 (------) [resending without a signature - I didn't see my reply land at http://debbugs.gnu.org/21065, so I wonder if the list filters are accidentally eating GPG-signed mail again] On 07/15/2015 09:31 AM, Eric Blake wrote: > tag 21065 notabug > thanks > > On 07/15/2015 07:25 AM, Rickard Norlander wrote: >> touch version 8.23 >> >> Command: >> $ touch -- '-' >> Happens: >> Returns successfully, but no file is created (if file exists, timestamp is >> not updated) > > Like many other tools, '-' is special-cased in touch to mean operation > on stdin: Looks like I'm not careful in what I wrote; most utilities treat '-' as stdin, but touch documented... > > $ touch --help | grep -A1 ' - ' > A FILE argument string of - is handled specially and causes touch to > change the times of the file associated with standard output. ...that it was affecting stdout. > > So you successfully touched stdin (in your case, /dev/tty). Either way, in your example, since you were using an interactive shell, /dev/tty was still touched, > If you want > to create a file named '-', use 'touch ./-'. and this advice still holds. On a related note, the just-released 8.24 fixed 'tee -' to NOT treat '-' as meaning stdout (which was a violation of POSIX) and to instead treat it as a literal file. Here's what POSIX says: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -. It's not obvious whether 'touch' is opening a file for reading or writing (it doesn't always have to open a file, after all, but if it creates the file it IS opening it even if it doesn't read or write to the file). We changed 'touch -' way back in 5.90, in 2005, when making a bunch of POSIX cleanups, so I guess the argument at the time probably still holds that we are not in violation of that guideline by treating '-' as stdout, even though POSIX does not explicitly describe that behavior in: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: Small bug in touch Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 15 Jul 2015 16:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: 21065-done@debbugs.gnu.org Received: via spool by 21065-done@debbugs.gnu.org id=D21065.143697873331216 (code D ref 21065); Wed, 15 Jul 2015 16:46:02 +0000 Received: (at 21065-done) by debbugs.gnu.org; 15 Jul 2015 16:45:33 +0000 Received: from localhost ([127.0.0.1]:50271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPoK-00086x-R2 for submit@debbugs.gnu.org; Wed, 15 Jul 2015 12:45:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42164) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFPoI-00080D-CR for 21065-done@debbugs.gnu.org; Wed, 15 Jul 2015 12:45:31 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 8C68536B1A2 for <21065-done@debbugs.gnu.org>; Wed, 15 Jul 2015 16:45:26 +0000 (UTC) Received: from [10.3.113.107] (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6FGjPwq017433 for <21065-done@debbugs.gnu.org>; Wed, 15 Jul 2015 12:45:26 -0400 References: <55A67CB9.8050703@redhat.com> <55A68C28.1060202@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <55A68E21.8060805@redhat.com> Date: Wed, 15 Jul 2015 10:45:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <55A68C28.1060202@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oOXT93e3R7DApEcmWjsLqWLCXG5TNuf24" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -6.4 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -6.4 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oOXT93e3R7DApEcmWjsLqWLCXG5TNuf24 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/15/2015 10:36 AM, Eric Blake wrote: > [resending without a signature - I didn't see my reply land at > http://debbugs.gnu.org/21065, so I wonder if the list filters are > accidentally eating GPG-signed mail again] Maybe I should have been more patient. Just after sending, I got all my messages, and now see them on the web page; on the other hand, the web page shows mails out of order: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21065#21 was sent later than http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21065#24 No idea where the delays are occurring, or if it is worth worrying about, or even if sending a message without a signature forced a flush of some pending queue. > Here's what POSIX says: >=20 > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html= >=20 > Guideline 13: > For utilities that use operands to represent files to be opened for= > either reading or writing, the '-' operand should be used to mean only > standard input (or standard output when it is clear from context that a= n > output file is being specified) or a file named -. But to add one more piece of information, POSIX also says: Where a utility described in the Shell and Utilities volume of POSIX.1-2008 as conforming to these guidelines is required to accept, or not to accept, the operand '-' to mean standard input or output, this usage is explained in the OPERANDS section. Otherwise, if such a utility uses operands to represent files, it is implementation-defined whether the operand '-' stands for standard input (or standard output), or for a file named -. and our change to 'tee' for 8.24 is correct, because 'tee' explicitly documented that '-' shall not mean stdout; whereas for 'touch', POSIX is silent (and it is therefore implementation-defined) about behavior of 'touch -'. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --oOXT93e3R7DApEcmWjsLqWLCXG5TNuf24 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVpo4hAAoJEKeha0olJ0NqhrgH/R63aMEbPDQiul/AeP8rQs0+ EmmKVXQ9LVnkYJ2OkzpXBdqmwtESSk8W4Wbb0xaBF6X491Ly2tikKp+YR5Xh3Nkd tdqOH7AOH5PZDVBWmamc/+uaZrnP+C4TBY8GcqzwD3XAZFjjrfiBiEWOdH+Fr7le qDMyMwZwGwD/oI3NRqCKL/8oGHJcqM7sd+mIjgydL+B1FxSWnHAfDU79QRkL9XHi P+0mBOGkpTGaJeE+8TiB+se4YHWLfQITpLSkHr5trVPU2Zfy4hiB5kBSeYKOwVnh Bc6v9+K5egjKH14VH5g4QD9NeAGLOVouf3MrrnB85sUQUWNCZQDa8dVgKgv12vo= =E8vi -----END PGP SIGNATURE----- --oOXT93e3R7DApEcmWjsLqWLCXG5TNuf24-- From unknown Mon Aug 18 11:25:44 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21065: bug#21056: [BUG] Bug with dirname on Ubuntu Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 16 Jul 2015 12:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21065 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Vinh Nguyen Cc: 21065@debbugs.gnu.org, Dave Patt Received: via spool by 21065-submit@debbugs.gnu.org id=B21065.14370498584864 (code B ref 21065); Thu, 16 Jul 2015 12:31:01 +0000 Received: (at 21065) by debbugs.gnu.org; 16 Jul 2015 12:30:58 +0000 Received: from localhost ([127.0.0.1]:50744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFiJV-0001GN-7b for submit@debbugs.gnu.org; Thu, 16 Jul 2015 08:30:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35450) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZFiJS-0001G7-M9 for 21065@debbugs.gnu.org; Thu, 16 Jul 2015 08:30:55 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D21DD3D0074; Thu, 16 Jul 2015 12:30:48 +0000 (UTC) Received: from [10.3.113.107] (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6GCUm7T023702; Thu, 16 Jul 2015 08:30:48 -0400 References: <55A5370D.2050805@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <55A7A3F2.10107@redhat.com> Date: Thu, 16 Jul 2015 06:30:42 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Xa2SRAMLpBJtJeb0lwsI50hW0RtnrSP58" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -6.3 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -6.3 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Xa2SRAMLpBJtJeb0lwsI50hW0RtnrSP58 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [adding the list back in, with permission] On 07/14/2015 07:47 PM, Vinh Nguyen wrote: > Dear Eric, > Thank you for your useful information about dirname function. But the m= ain thing I wanted to report is not the way to use dirname, but the weird= behavior of dirname loading library named "." into the running process a= nd cause error "Error while mapping shared library sections. '.' is not i= n executable format: Is a directory" and segmentation fault subsequently.= The document says nothing about this behavior so it is a bug. Also, Dl_i= nfo's dli_fname is a char array, not const char* so the cast in "dirname(= (char*)info.dli_fname)" just do nothing. > I'm looking forward to hearing from you soon. Your problem stems from the fact that calling dirname() modifies its argument. >> Dl_info info; >> if ( dladdr( ( const void* )function_to_get_address, &info ) =3D= =3D 0 ) >> return false; >> if ( info.dli_fname =3D=3D NULL ) >> return false; >> dirname((char*)info.dli_fname); (1) Whatever info.dli_fname was prior to dirname, it was modified in place to now be "." after the invalid call. So now that it has a changed value, it is messing with all the assumptions of the rest of dl*() that assume the name will not be changed. I stand by my assertion that the bug is in your invalid use of dirname().= --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Xa2SRAMLpBJtJeb0lwsI50hW0RtnrSP58 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVp6PyAAoJEKeha0olJ0NqiMEH/339Vx5uQi041yA7QIHW+5h8 mNXjx+pbr1E7vkewiXxheuo4gVU/vT5noqeJ4CsBUNAokYagiKaFJ6Filpc8MUcP 76w4yH1jk7SVX4vOsPRpwUY5EsWUpiCkpzKxeoAlaCMr1grjdf+DOyoFp/cMN6oC eu6TZdVrcVHF/KOhafnY/XEVsVfOoUz0vHB46f4wgxFD2oqmvzsIBbT+h+MnkEyx fAzTyoWyOW/Eix8jz4JmK/3Ze2uvjAtYO6L73qSi2ECkPTvUQnYLdnpepL6fgYqN ugrYHRatSO7krOm7qS+tf7EEiPEvmkjf0YC4s024H7LElpQdbQU3dped/Qr+C3I= =HT0Q -----END PGP SIGNATURE----- --Xa2SRAMLpBJtJeb0lwsI50hW0RtnrSP58--