X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:message-id:from:to:subject :content-type:date:content-transfer-encoding; q=dns; s=default; b= aWQQDBSw+fdnWD7HYXTCHp15H2RNYnvKYHsboaWpccRfJu0TNXi02VDfkEPsec25 kxxiYJZzlrtdYPlxGxnH6YB0dlqVKMOtlEZMOw4D0dGS2QAGz0PXJS5jiJ1fwXDi myQmryjkgHxjAvx+6M7Q8vBwHyraoiETOp4ZNQI0MNw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:message-id:from:to:subject :content-type:date:content-transfer-encoding; s=default; bh=F76t vU09RGD6yOVPEqkxIf2/OrY=; b=QncNtmpiyAqKxFW95iLn+w8r3miH+v5kPcOL UUVrfH0irB9NdYbAfDfA2Zgg63ZlKn3+14pLRQ4gFWYXv7gYHgmipRY9FbCNniz7 WOZ4eftavXR7QZR+nIZshyIYjjm+S5O/f7VvxZKTLanObAkncvsIKg3Xu7Lkfyuh 2KAV3uk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=sincerely X-HELO: mout.gmx.net MIME-Version: 1.0 Message-ID: From: "Sven Eden" To: cygwin AT cygwin DOT com Subject: Problematic interpretion of paths starting with double slashes Content-Type: text/plain; charset=UTF-8 Date: Tue, 12 Jun 2018 10:53:50 +0200 Sensitivity: Normal X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id w5C8s4Zw022904 Hello everybody,   I have a problem with a script that wants to copy a file, which has a variable paths build from various variables. The first variable is a possible prefix, the second an absolute path. If no prefix is needed, the first consists of just a slash. What I now see is the following: -------- # 09:29:17 SEden AT CHH0711 ~ > rm -rf /tmp/foo # 09:29:37 SEden AT CHH0711 ~ > mkdir -p /tmp/foo # 09:29:42 SEden AT CHH0711 ~ > touch /tmp/foo/bar # 09:29:59 SEden AT CHH0711 ~ > cp //tmp/foo/bar /tmp/foo/baz cp: cannot stat '//tmp/foo/bar': No such file or directory -------- This puzzled me, because this works perfectly well on every GNU/Linux (plus WSL) system I tried. Actually it is completely in order to double any slashes. This behavior breaks quite some Makefiles... I am completely aware that §4.13 of the Open Group Base Specification Issue 7 (IEEE Std 1003.1-2017) reads: "If a pathname begins with two successive characters, the first component following the leading characters may be interpreted in an implementation-defined manner, although more than two leading characters shall be treated as a single character." My question therefore is, whether the behavior can be gotten nearer what every other GNU/Linux system does. Maybe, if said first component can not be resolved as an smb host, try an absolute path instead? On any Linux system, 'stat -c "%i" / //' would show the same inode number twice: -------- stat -c "%2n %f %i" / // / 41ed 48976645948727610 // 41ed 48976645948727610 -------- On Cygwin we get: -------- stat -c "%2n %f %i" / // / 41ed 4222124652325260 // 416d 18014896789143535314 -------- I have searched the cygwin mailing list, but all I could find was some discussion about UNC paths from 1997. So, what do you think? Sincerely Sven P.S An example of a failing script line is: https://github.com/gentoo/gentoo/blob/331976f/eclass/toolchain.eclass#L2136 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple