Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: NO_CASE_GLOB and unreadable directories (Episode VI: A New Hope)



Bart Schaefer wrote on Thu, Feb 04, 2021 at 21:53:12 -0800:
> It's actually the documentation that gets more complicated, the code
> is pretty simple.  I rewrote the paragraph I've added to options.yo
> about seven times and I'm still not entirely happy with it.

Took a stab at it, below.

> What I elected was to keep the current behavior by default, and add an
> option to get the behavior that termux wants.  I named it CASE_PATHS
> for reasons I think the documentation paragraph make obvious.

Hmm.  It may be a bikeshed, but might people guess an option named
CASE_PATHS has to do with $PATH?

> +++ b/Doc/Zsh/options.yo
> @@ -474,6 +474,22 @@ item(tt(CASE_MATCH) <D>)(
> +pindex(CASE_PATHS)
> +pindex(NO_CASE_PATHS)
> +pindex(CASEPATHS)
> +pindex(NOCASEPATHS)
> +cindex(case-sensitive globbing, option)
> +item(tt(CASE_PATHS))(
> +If tt(CASE_PATHS) is not set (the default), tt(CASE_GLOB) affects the
> +interpretation of em(every) path component, whenever a special
> +character appears in em(any) component.  When tt(CASE_PATHS) is set,
> +file path components that do em(not) contain special filename
> +generation characters are always sensitive to case, thus restricting
> +tt(NO_CASE_GLOB) to components that contain globbing characters.
> +
> +Note that if the filesystem itself is not sensitive to case, then
> +tt(CASE_PATHS) has no effect.

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index b3bf11f5c..4aca04746 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -463,6 +463,12 @@ the presence of any character which is special to filename generation
 will cause case-insensitive matching.  For example, tt(cvs+LPAR()/+RPAR())
 can match the directory tt(CVS) owing to the presence of the globbing flag
 (unless the option tt(BARE_GLOB_QUAL) is unset).
+
+The case-insensitive matching is affected by the tt(CASE_PATHS) option,
+which see.
+
+Note that if the filesystem itself is not sensitive to case, then
+this option has no effect.
 )
 pindex(CASE_MATCH)
 pindex(NO_CASE_MATCH)
@@ -474,6 +480,23 @@ item(tt(CASE_MATCH) <D>)(
 Make regular expressions using the tt(zsh/regex) module (including
 matches with tt(=~)) sensitive to case.
 )
+pindex(CASE_PATHS)
+pindex(NO_CASE_PATHS)
+pindex(CASEPATHS)
+pindex(NOCASEPATHS)
+cindex(case-sensitive globbing, option)
+item(tt(CASE_PATHS))(
+This option only has an effect when the tt(CASE_GLOB) option is unset, which is
+not the default.
+
+This option governs the case-insensitive matching used when the tt(CASE_GLOB)
+option is unset.  When this option is unset (the default), whenever a special
+character appears in em(any) path component, em(all) components will be
+interpreted case-insensitively.  When this option is set, 
+file path components that do em(not) contain special filename
+generation characters are always sensitive to case, thus restricting
+tt(NO_CASE_GLOB) to components that contain globbing characters.
+)
 pindex(CSH_NULL_GLOB)
 pindex(NO_CSH_NULL_GLOB)
 pindex(CSHNULLGLOB)




Messages sorted by: Reverse Date, Date, Thread, Author