From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130892 invoked by alias); 29 Apr 2016 00:09:29 -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 130875 invoked by uid 89); 29 Apr 2016 00:09:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=anrdaemon@yandex.ru, anrdaemonyandexru, U*gene.pavlovsky, sk:gene.pa X-HELO: mail-ig0-f196.google.com Received: from mail-ig0-f196.google.com (HELO mail-ig0-f196.google.com) (209.85.213.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 29 Apr 2016 00:09:18 +0000 Received: by mail-ig0-f196.google.com with SMTP id rc4so764932igc.0 for ; Thu, 28 Apr 2016 17:09:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=nsD5O6n+l7m9nHRtlUBLQUlnUoYmFaASFKFQUSMKQFk=; b=mEeYqYF136avQALV313G/5KII3Js5PEfTszvKKSbrBYT/UJLX7Z790RxJJ1FZZuEjq R3fgB5YCk+X1XIpL0MmAxH9cVhzSJuucgvM7LkWn++iACiQGNlR94GinBQG0qSp5Mq9i gK5jbM9JrdIacnUi3tooYRge+GA5OUhtdeBpMTpp70NVX+oV3fVINyPwRCPSGFovG0Kf z47OGrhqArjaH06gzGnj6wli3Clfn+7GuUEFPNSMGGBu0FVf+YjmrJg3ScTDhD+6ziWQ pB8C46skoCtwWZWvWp9Z8GuEnfXqmCQ52hRGg/XzRp85+IakJDcw+y4bFybTDaSC9W3C Sl9w== X-Gm-Message-State: AOPr4FXY3qXMCVFY9hnPxFRQpFeN+1NnuVxQAjPFxbLxZIaGi2654QkhEB3PejnV9FAKIS8Y1/99qn4rtWbCHQ== MIME-Version: 1.0 X-Received: by 10.50.60.68 with SMTP id f4mr885035igr.34.1461888556260; Thu, 28 Apr 2016 17:09:16 -0700 (PDT) Received: by 10.79.22.134 with HTTP; Thu, 28 Apr 2016 17:09:16 -0700 (PDT) In-Reply-To: References: <1606116423.20160429020650@yandex.ru> Date: Fri, 29 Apr 2016 01:46:00 -0000 Message-ID: Subject: Re: `CYGWIN=winsymlinks:nativestrict`, `ln -s target link` fails if target doesn't exist From: Gene Pavlovsky To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2016-04/txt/msg00635.txt.bz2 The list of errors that might be returned by symlink(2) mention target only 3 times: EFAULT target or linkpath points outside your accessible address space. ENAMETOOLONG target or linkpath was too long. ENOENT A directory component in linkpath does not exist or is a dangling symbolic link, or target or linkpath is an empty string. So my understanding is: target must be non-empty, not too long, and don't point outside the accessible address space. Nothing about existence. --Gene On 29 April 2016 at 03:05, Gene Pavlovsky wrote: > I don't know if POSIX standard has something to say about that, but > here's a reference from GNU libc: > > `man 2 symlink`: >> A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent one; the latter case is known as a dangling link. > > On 29 April 2016 at 02:06, Andrey Repin wrote: >> Greetings, Gene Pavlovsky! >> >>> I have an issue to report: >> >>> Introduction: On a UNIX system, `ln -s target link` creates a link >>> regardless of target's existence. >>> This is used in some scripts, e.g. Gentoo's `run-crons` (which I also >>> use on Cygwin) uses a symlink pointing to the running process PID as >>> lockfile. >>> Issue: if `CYGWIN=winsymlinks:nativestrict` env var is set, running >>> `ln -s target link` completely fails (even though running `mklink link >>> target` in `cmd.exe` succeeds, same as `ln -s` does on UNIX). If >>> `CYGWIN=winsymlinks:native`, a non-native link is created. >> >>> So, `nativestrict` might break some (admittedly unorthodox) scripts. >>> With `native` these script work, but still a native link would be >>> preferrable and it is possible to create, but a non-native link is >>> created instead. >> >>> Bottom line, I think the native symlink creation code should be >>> checked and a possibility should be added to create links to >>> non-existent targets, rather than the current behavior of failing. >> >> This is actually an arguable behavior, even in Linux. I can imagine the >> behavior is "undefined" in such a case. >> But I'll leave final say to the more experienced members of the list. >> >> >> -- >> With best regards, >> Andrey Repin >> Friday, April 29, 2016 01:55:21 >> >> Sorry for my terrible english... >> -- 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