zsh-users
 help / color / mirror / code / Atom feed
* Undocumented numeric globbing flags
@ 2016-07-25 16:32 Peter Stephenson
  2016-07-25 20:57 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2016-07-25 16:32 UTC (permalink / raw)
  To: Zsh Users' List

Does anyone use the undocumented globbing flag feature that a number
with no flag is treated as a set of octal bits to "and" with the file
mode?

I only discovered this when I mistyped a set of flags that should have
contained a numeric argument and it was silently misinterpreted as
something entirely different.

As far as I can see this is completely superseded by the "f" qualifier.

pws


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

* Re: Undocumented numeric globbing flags
  2016-07-25 16:32 Undocumented numeric globbing flags Peter Stephenson
@ 2016-07-25 20:57 ` Bart Schaefer
  2016-07-26  9:20   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2016-07-25 20:57 UTC (permalink / raw)
  To: Zsh Users' List

On Jul 25,  5:32pm, Peter Stephenson wrote:
}
} Does anyone use the undocumented globbing flag feature that a number
} with no flag is treated as a set of octal bits to "and" with the file
} mode?

I can't remember ever having done so.  Falstad probably did, 25 years ago.
:-)


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

* Re: Undocumented numeric globbing flags
  2016-07-25 20:57 ` Bart Schaefer
@ 2016-07-26  9:20   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2016-07-26  9:20 UTC (permalink / raw)
  To: Zsh Users' List

On Mon, 25 Jul 2016 13:57:07 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jul 25,  5:32pm, Peter Stephenson wrote:
> }
> } Does anyone use the undocumented globbing flag feature that a number
> } with no flag is treated as a set of octal bits to "and" with the file
> } mode?
> 
> I can't remember ever having done so.  Falstad probably did, 25 years ago.
> :-)

Sounds like cruft.

pws

diff --git a/README b/README
index d5343db..9de5eb4 100644
--- a/README
+++ b/README
@@ -79,6 +79,14 @@ Other aspects of EXIT trap handling have not changed --- there is still
 only one EXIT trap at any point in a programme, so it is not generally
 useful to combine POSIX and non-POSIX behaviour in the same script.
 
+4) There was an undocumented feature dating from the early days of zsh
+that glob qualifiers consisting only of the digits 0 to 7 were treated
+as an octal file mode to "and" with the modes of files being tested.
+This has been removed in order to be more sensitive to syntax errors.
+The "f" qualifier has for many years been the documented way of testing
+file modes; it allows the "and" test ("*(f+1)" is the documented
+equivalent of "*(1)") as well as many other forms.
+
 Incompatibilities between 5.0.8 and 5.2
 ---------------------------------------
 
diff --git a/Src/glob.c b/Src/glob.c
index 850405f..a845c5f 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1282,14 +1282,7 @@ zglob(LinkList list, LinkNode np, int nountok)
 		*ptr = '-';
 	while (*s && !newcolonmod) {
 	    func = (int (*) _((char *, Statptr, off_t, char *)))0;
-	    if (idigit(*s)) {
-		/* Store numeric argument for qualifier */
-		func = qualflags;
-		data = 0;
-		sdata = NULL;
-		while (idigit(*s))
-		    data = data * 010 + (*s++ - '0');
-	    } else if (*s == ',') {
+	    if (*s == ',') {
 		/* A comma separates alternative sets of qualifiers */
 		s++;
 		sense = 0;


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

end of thread, other threads:[~2016-07-26  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 16:32 Undocumented numeric globbing flags Peter Stephenson
2016-07-25 20:57 ` Bart Schaefer
2016-07-26  9:20   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).