From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92004 invoked by alias); 12 Feb 2017 17:39:03 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 91953 invoked by uid 89); 12 Feb 2017 17:38:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=getcwd, H*RU:sk:mrelaye, Hx-spam-relays-external:sk:mrelaye X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 12 Feb 2017 17:38:55 +0000 Received: from [192.168.178.45] ([95.91.244.74]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.183]) with ESMTPSA (Nemesis) id 0M2XRt-1cMfc62dc5-00sKnN for ; Sun, 12 Feb 2017 18:38:51 +0100 Subject: Re: cygpath -w converts relative paths to absolute windows paths To: cygwin@cygwin.com References: <10eb657d-a00b-1609-a9b9-6373092c1ac1@polyhack.io> <20170212112314.GE11666@calimero.vinschen.de> From: Thomas Wolff Message-ID: <6055a8e1-bfd7-16c7-f25a-e02523863fdd@towo.net> Date: Sun, 12 Feb 2017 17:39:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20170212112314.GE11666@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-UI-Out-Filterresults: notjunk:1;V01:K0:sNf1k7ryi7A=:UI9KwZVid5iSLWXHMtyHQe t8/rY3zaS6G1htvZfuKKhXTz+K5JT1A1KzC5f63LSydn0gq3UApfUQwbqkGDG/NpqPKE4fQSR zq7OQdfXdGc8w/bdWv3AVsww77uCMy9AAcOUVgyb6V4DiXs0XZ7Hx4Mvh0NDuqhlly7lVnfgM zL8nJV38qLi0KZYNeTf/KbKJHon42kz8milFx2n3DmVvSk5LyaIJ7rIBd2x2ITWGR7lYJmYm5 Yj2gnh+6Dvc33soYBWQmXg3aOEFgOYgOYoiD12/Q2CgH2SdXfcK9n+Tnnb/l1FF82BAOJmO+o HMOM6wMJ6xmQfIYcMVtrBFwPxXWDGaRT7ec+TrqA4qJbsCoAdlz3Y64U8ALtWOIhgT/YZwBlA GgfzKFo6WO5i2ejTuNKdxeJm24XMBUhNxEtIRNT688SKQxr8kqgnrzkElKBNB9bEB1S34DzLP 2n5lAEMooMm1LJzkAx/rivffFM+alGu9cgwrsE5c0giQZ9egLpRJ5B87QpYtzNJwrOtCwHGQh juN9uUU14pIupabU+1C93FXwnGqN1QlJJ53R5jg5Od1wPhq8z2AcQK3Y1ajT7b+XX5mHK1rfE 1LAuzf3ZXuMSNla/Ykb+Xyk2C/etvyFfoMqFcUGd4kTvlk9YA759XMU0220zRIsXhF2cxdtU8 9FnOdWl4Fwom40aUmbrh/2D8Xcc01dbW9TwymVLX1Ou7X3b592IN42CkFzgu969eqw8dn8ZNZ Jq1C4tDEOVcFM2K3 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00163.txt.bz2 Am 12.02.2017 um 12:23 schrieb Corinna Vinschen: > On Feb 7 14:35, Roger Qiu wrote: >> Hi, >> >> I've found that `cygpath --windows '../` will give back an absolute windows >> path. >> >> I thought this would only happen if you provide the `--absolute` flag, or >> when the path is a special cygwin path. >> >> But this occurs just for normal directories. >> >> I have come across a situation where I need to convert ntfs symlinks to unix >> symlinks and back. Sometimes these symlinks have relative paths them. Now by >> using cygpath --windows, I get back absolute paths, which means the >> integrity of the symlink isn't preserved. >> >> Can `cygpath --windows '../directory'` give back `..\directory` for paths >> aren't special cygwin paths? These relative backslashes are supported in >> Windows right now. > Not easily. All paths are evaluated as absolute paths inside Cygwin. > The result of the path conversion is always an absolute path. A relative > path is generated from there by checking if the path prefix in POSIX > notation is identical to the current working directory. If not, the > path stays absolute. Naturally, if you use a "..", the resulting path > does not match the CWD anymore, so you're out. How about converting getcwd(), too, and comparing that? ------ Thomas -- 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