From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 3FF6C3947426; Fri, 30 Jul 2021 14:49:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FF6C3947426 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jon TURNEY To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: Add winsymlinks:sys X-Act-Checkin: newlib-cygwin X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 66eefa25f24c441d4e3b96da18c09a9fd3eec01f X-Git-Newrev: 38965159dfcaa58a4874d6b00818d41b6f13d5c1 Message-Id: <20210730144956.3FF6C3947426@sourceware.org> Date: Fri, 30 Jul 2021 14:49:56 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2021 14:49:56 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=38965159dfcaa58a4874d6b00818d41b6f13d5c1 commit 38965159dfcaa58a4874d6b00818d41b6f13d5c1 Author: Jon Turney Date: Sat Jul 17 15:51:11 2021 +0100 Cygwin: Add winsymlinks:sys Add winsymlinks:sys, to explicitly select always using plain files with the system attribute containing a magic cookie to represent a symlink. Diff: --- winsup/cygwin/environ.cc | 2 ++ winsup/cygwin/globals.cc | 3 ++- winsup/cygwin/path.cc | 3 ++- winsup/doc/cygwinenv.xml | 20 +++++++++++++++++++- winsup/doc/pathnames.xml | 29 +++++++++++++++++++---------- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 3a03657db..a14b47953 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -82,6 +82,8 @@ set_winsymlinks (const char *buf) allow_winsymlinks = WSYM_lnk; else if (ascii_strncasematch (buf, "lnk", 3)) allow_winsymlinks = WSYM_lnk; + else if (ascii_strncasematch (buf, "sys", 3)) + allow_winsymlinks = WSYM_sysfile; /* Make sure to try native symlinks only on systems supporting them. */ else if (ascii_strncasematch (buf, "native", 6)) allow_winsymlinks = ascii_strcasematch (buf + 6, "strict") diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc index 066026421..48fb312de 100644 --- a/winsup/cygwin/globals.cc +++ b/winsup/cygwin/globals.cc @@ -57,7 +57,8 @@ enum winsym_t WSYM_lnk, WSYM_native, WSYM_nativestrict, - WSYM_nfs + WSYM_nfs, + WSYM_sysfile, }; exit_states NO_COPY exit_state; diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index cd029c5b4..baf04ce89 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2071,6 +2071,7 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice) /* On FSes not supporting reparse points, or in case of an error creating the WSL symlink, fall back to creating the plain old SYSTEM file symlink. */ + wsym_type = WSYM_sysfile; break; default: break; @@ -2211,7 +2212,7 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice) * sizeof (WCHAR); cp += *plen; } - else + else /* wsym_type == WSYM_sysfile */ { /* Default technique creating a symlink. */ buf = tp.t_get (); diff --git a/winsup/doc/cygwinenv.xml b/winsup/doc/cygwinenv.xml index a52b6ac19..649084dfa 100644 --- a/winsup/doc/cygwinenv.xml +++ b/winsup/doc/cygwinenv.xml @@ -76,11 +76,17 @@ in addition to the normal UNIX argv list. Defaults to not set. -winsymlinks:{lnk,native,nativestrict} - if set to just +winsymlinks:{lnk,native,nativestrict,sys} + + + +If set to just winsymlinks or winsymlinks:lnk, Cygwin creates symlinks as Windows shortcuts with a special header and the R/O attribute set. + + If set to winsymlinks:native or winsymlinks:nativestrict, Cygwin creates symlinks as native Windows symlinks on filesystems and OS versions supporting them. @@ -92,9 +98,21 @@ some reason, it will fall back to creating Cygwin default symlinks with winsymlinks:native, while with winsymlinks:nativestrict the symlink(2) system call will immediately fail. + + + +If set to winsymlinks:sys, Cygwin creates symlinks as +plain files with the system attribute, containing a magic +cookie followed by the path to which the link points. + + + +Note that this setting has no effect where Cygwin knows that the +filesystem only supports a creating symlinks in a specific way. For more information on symbolic links, see . + diff --git a/winsup/doc/pathnames.xml b/winsup/doc/pathnames.xml index 2966bdabf..1ab45c130 100644 --- a/winsup/doc/pathnames.xml +++ b/winsup/doc/pathnames.xml @@ -389,16 +389,25 @@ ways. -The default symlinks created by Cygwin are either special reparse -points shared with WSL on Windows 10, or plain files containing a magic -cookie followed by the path to which the link points. The reparse point -is used on NTFS, the plain file on almost any other filesystem. - -Symlinks created by really old Cygwin releases (prior to -Cygwin 1.7.0) are usually readable. However, you could run into problems -if you're now using another character set than the one you used when -creating these symlinks (see ). - + The default symlinks created by Cygwin are: + + + + special reparse points shared with WSL (on NTFS on Windows 10 1607 + or later) + + + plain files with the system attribute, containing + a magic cookie followed by the path to which the link points. + + Symlinks of this type created by really old Cygwin releases + (prior to Cygwin 1.7.0) are usually readable. However, you could run into + problems if you're now using another character set than the one you used + when creating these symlinks (see ). + + +