public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/2] Add more winsymlinks values (v2)
@ 2021-07-29 17:20 Jon Turney
  2021-07-29 17:20 ` [PATCH 1/2] Rename WSYM_sysfile to WSM_default Jon Turney
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jon Turney @ 2021-07-29 17:20 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

* Rename magic -> sys
* Drop wslstrict, since I'm not sure it's useful or a good idea.
* Refine documentation changes a bit more

Jon Turney (2):
  Rename WSYM_sysfile to WSM_default
  Add winsymlinks:sys

 winsup/cygwin/environ.cc |  2 ++
 winsup/cygwin/globals.cc |  7 ++++---
 winsup/cygwin/path.cc    |  9 +++++----
 winsup/doc/cygwinenv.xml | 20 +++++++++++++++++++-
 winsup/doc/pathnames.xml | 29 +++++++++++++++++++----------
 5 files changed, 49 insertions(+), 18 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Rename WSYM_sysfile to WSM_default
  2021-07-29 17:20 [PATCH 0/2] Add more winsymlinks values (v2) Jon Turney
@ 2021-07-29 17:20 ` Jon Turney
  2021-07-29 17:20 ` [PATCH 2/2] Add winsymlinks:sys Jon Turney
  2021-07-30  9:35 ` [PATCH 0/2] Add more winsymlinks values (v2) Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Jon Turney @ 2021-07-29 17:20 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

Rename WSYM_sysfile to WSM_default, since it selects more than just
sysfile with magic cookie now.
---
 winsup/cygwin/globals.cc | 4 ++--
 winsup/cygwin/path.cc    | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc
index 3b25c2803..066026421 100644
--- a/winsup/cygwin/globals.cc
+++ b/winsup/cygwin/globals.cc
@@ -53,7 +53,7 @@ enum exit_states
    "winsymlinks" setting of the CYGWIN environment variable. */
 enum winsym_t
 {
-  WSYM_sysfile = 0,
+  WSYM_default = 0,
   WSYM_lnk,
   WSYM_native,
   WSYM_nativestrict,
@@ -71,7 +71,7 @@ bool ignore_case_with_glob;
 bool pipe_byte;
 bool reset_com;
 bool wincmdln;
-winsym_t allow_winsymlinks = WSYM_sysfile;
+winsym_t allow_winsymlinks = WSYM_default;
 bool disable_pcon;
 
 bool NO_COPY in_forkee;
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 1869fb8c8..cd029c5b4 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2013,7 +2013,7 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
       /* Don't try native symlinks on FSes not supporting reparse points. */
       else if ((wsym_type == WSYM_native || wsym_type == WSYM_nativestrict)
 	       && !(win32_newpath.fs_flags () & FILE_SUPPORTS_REPARSE_POINTS))
-	wsym_type = WSYM_sysfile;
+	wsym_type = WSYM_default;
 
       /* Attach .lnk suffix when shortcut is requested. */
       if (wsym_type == WSYM_lnk && !win32_newpath.exists ()
@@ -2059,9 +2059,9 @@ symlink_worker (const char *oldpath, path_conv &win32_newpath, bool isdevice)
 	      __leave;
 	    }
 	  /* Otherwise, fall back to default symlink type. */
-	  wsym_type = WSYM_sysfile;
+	  wsym_type = WSYM_default;
 	  fallthrough;
-	case WSYM_sysfile:
+	case WSYM_default:
 	  if (win32_newpath.fs_flags () & FILE_SUPPORTS_REPARSE_POINTS)
 	    {
 	      res = symlink_wsl (oldpath, win32_newpath);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Add winsymlinks:sys
  2021-07-29 17:20 [PATCH 0/2] Add more winsymlinks values (v2) Jon Turney
  2021-07-29 17:20 ` [PATCH 1/2] Rename WSYM_sysfile to WSM_default Jon Turney
@ 2021-07-29 17:20 ` Jon Turney
  2021-07-30  9:35 ` [PATCH 0/2] Add more winsymlinks values (v2) Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Jon Turney @ 2021-07-29 17:20 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

Add winsymlinks:sys, to explicitly select always using plain files
containing a magic cookie to represent a symlink.
---
 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.</para>
 </listitem>
 
 <listitem>
-<para><envar>winsymlinks:{lnk,native,nativestrict}</envar> - if set to just
+<para><envar>winsymlinks:{lnk,native,nativestrict,sys}</envar></para>
+
+<itemizedlist mark="square">
+<listitem>
+<para>If set to just
 <literal>winsymlinks</literal> or <literal>winsymlinks:lnk</literal>,
 Cygwin creates symlinks as Windows shortcuts with a special header and
 the R/O attribute set.</para>
+</listitem>
 
+<listitem>
 <para>If set to <literal>winsymlinks:native</literal> or
 <literal>winsymlinks:nativestrict</literal>, Cygwin creates symlinks as
 native Windows symlinks on filesystems and OS versions supporting them.</para>
@@ -92,9 +98,21 @@ some reason, it will fall back to creating Cygwin default symlinks
 with <literal>winsymlinks:native</literal>, while with
 <literal>winsymlinks:nativestrict</literal> the <literal>symlink(2)</literal>
 system call will immediately fail.</para>
+</listitem>
+
+<listitem>
+<para>If set to <literal>winsymlinks:sys</literal>, Cygwin creates symlinks as
+plain files with the <literal>system</literal> attribute, containing a magic
+cookie followed by the path to which the link points.</para>
+</listitem>
+</itemizedlist>
+
+<para>Note that this setting has no effect where Cygwin knows that the
+filesystem only supports a creating symlinks in a specific way.</para>
 
 <para>For more information on symbolic links, see
 <xref linkend="pathnames-symlinks"></xref>.</para>
+
 </listitem>
 
 <listitem>
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.</para>
 <itemizedlist mark="bullet">
 
 <listitem>
-<para>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.</para>
-
-<note><para>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 <xref linkend="setup-locale-problems"></xref>).
-</para></note>
+  <para>The default symlinks created by Cygwin are:</para>
+
+  <itemizedlist mark="square">
+    <listitem>
+      <para>special reparse points shared with WSL (on NTFS on Windows 10 1607
+      or later)</para>
+    </listitem>
+    <listitem>
+      <para>plain files with the <literal>system</literal> attribute, containing
+      a magic cookie followed by the path to which the link points.
+      </para>
+      <note><para>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 <xref
+      linkend="setup-locale-problems"></xref>).
+      </para></note>
+    </listitem>
+  </itemizedlist>
 </listitem>
 
 <listitem>
-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Add more winsymlinks values (v2)
  2021-07-29 17:20 [PATCH 0/2] Add more winsymlinks values (v2) Jon Turney
  2021-07-29 17:20 ` [PATCH 1/2] Rename WSYM_sysfile to WSM_default Jon Turney
  2021-07-29 17:20 ` [PATCH 2/2] Add winsymlinks:sys Jon Turney
@ 2021-07-30  9:35 ` Corinna Vinschen
  2 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2021-07-30  9:35 UTC (permalink / raw)
  To: cygwin-patches

On Jul 29 18:20, Jon Turney wrote:
> * Rename magic -> sys
> * Drop wslstrict, since I'm not sure it's useful or a good idea.
> * Refine documentation changes a bit more
> 
> Jon Turney (2):
>   Rename WSYM_sysfile to WSM_default
>   Add winsymlinks:sys
> 
>  winsup/cygwin/environ.cc |  2 ++
>  winsup/cygwin/globals.cc |  7 ++++---
>  winsup/cygwin/path.cc    |  9 +++++----
>  winsup/doc/cygwinenv.xml | 20 +++++++++++++++++++-
>  winsup/doc/pathnames.xml | 29 +++++++++++++++++++----------
>  5 files changed, 49 insertions(+), 18 deletions(-)
> 
> -- 
> 2.32.0

LGTM


Thanks,
Corinna

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-30  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 17:20 [PATCH 0/2] Add more winsymlinks values (v2) Jon Turney
2021-07-29 17:20 ` [PATCH 1/2] Rename WSYM_sysfile to WSM_default Jon Turney
2021-07-29 17:20 ` [PATCH 2/2] Add winsymlinks:sys Jon Turney
2021-07-30  9:35 ` [PATCH 0/2] Add more winsymlinks values (v2) Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).