* Re: Dynamically adding to $mailpath? [not found] <6134254DE87BD411908B00A0C99B044F03A0B5AC@MOWD019A> @ 2002-12-19 12:06 ` Oliver Kiddle 2002-12-19 12:44 ` Borzenkov Andrey 0 siblings, 1 reply; 5+ messages in thread From: Oliver Kiddle @ 2002-12-19 12:06 UTC (permalink / raw) To: zsh-workers Andrey wrote: > > mailpath=((${$(echo ~/mail/*.spool(N))//(#m)*/$MATCH?You have new mail in > ${MATCH:r:t}})) > > should work though. Unfortunately you still need one fork (echo) unless I > miss some obvious way to treat result of nested globbing as array. My attempt at this was along the lines of: mailpath=( ~/mail/*.spool(e:'REPLY=( "${REPLY}?You have new mail in ${REPLY:t:r}")':) ) it doesn't need a fork but there seems to be a bug somewhere because I get `zsh: unmatched "' errors. It's okay if I remove the :t:r modifiers though. And running this twice in 4.1.0-dev-6 (but not in 4.0.2) causes a seg fault: echo *(e:'REPLY=( ${REPLY}?${REPLY} )':) (I forgot to quote the ? when trying that) Oliver This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Dynamically adding to $mailpath? 2002-12-19 12:06 ` Dynamically adding to $mailpath? Oliver Kiddle @ 2002-12-19 12:44 ` Borzenkov Andrey 2002-12-19 16:10 ` Bart Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Borzenkov Andrey @ 2002-12-19 12:44 UTC (permalink / raw) To: 'Oliver Kiddle', zsh-workers > > Andrey wrote: > > > > mailpath=((${$(echo ~/mail/*.spool(N))//(#m)*/$MATCH?You have new mail > in > > ${MATCH:r:t}})) > > > > should work though. Unfortunately you still need one fork (echo) unless > I > > miss some obvious way to treat result of nested globbing as array. > > My attempt at this was along the lines of: > > mailpath=( ~/mail/*.spool(e:'REPLY=( "${REPLY}?You have new mail in > ${REPLY:t:r}")':) ) > > it doesn't need a fork but there seems to be a bug somewhere because I > get `zsh: unmatched "' errors. It's okay if I remove the :t:r modifiers > though. > And leaving just one of modifiers results in zsh: unknown file attribute. -andrey ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Dynamically adding to $mailpath? 2002-12-19 12:44 ` Borzenkov Andrey @ 2002-12-19 16:10 ` Bart Schaefer 2002-12-19 17:04 ` Oliver Kiddle 0 siblings, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2002-12-19 16:10 UTC (permalink / raw) To: zsh-workers On Dec 19, 1:06pm, Oliver Kiddle wrote: } Subject: Re: Dynamically adding to $mailpath? } } mailpath=( ~/mail/*.spool(e:'REPLY=( "${REPLY}?You have new mail in ${REPLY:t:r}")':) ) } } it doesn't need a fork but there seems to be a bug somewhere because I } get `zsh: unmatched "' errors. It's okay if I remove the :t:r modifiers } though. On Dec 19, 3:44pm, Borzenkov Andrey wrote: } } And leaving just one of modifiers results in zsh: unknown file attribute. It's a simple parsing issue. The double-quotes aren't significant to the glob parser, so the colons cause the parse tokens to be e REPLY=( "${REPLY}?You have new mail in ${REPLY t r}") Try it this way: mailpath=( ~/mail/*.spool(e['REPLY=( "${REPLY}?You have new mail in ${REPLY:t:r}")']) ) On Dec 19, 1:06pm, Oliver Kiddle wrote: } } And running this twice in 4.1.0-dev-6 (but not in 4.0.2) causes a seg fault: } echo *(e:'REPLY=( ${REPLY}?${REPLY} )':) } } (I forgot to quote the ? when trying that) It causes a seg fault immediately in 4.0.6, so it's something that changed after 4.0.2. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Dynamically adding to $mailpath? 2002-12-19 16:10 ` Bart Schaefer @ 2002-12-19 17:04 ` Oliver Kiddle 2003-02-19 18:18 ` PATCH: fix problem with globs inside (e) glob qualifier Oliver Kiddle 0 siblings, 1 reply; 5+ messages in thread From: Oliver Kiddle @ 2002-12-19 17:04 UTC (permalink / raw) To: zsh-workers On Bart wrote: > On Dec 19, 3:44pm, Borzenkov Andrey wrote: > } > } And leaving just one of modifiers results in zsh: unknown file attribute. > > It's a simple parsing issue. The double-quotes aren't significant to the > glob parser, so the colons cause the parse tokens to be Oops, sorry. I should have thought to try that. > It causes a seg fault immediately in 4.0.6, so it's something that changed > after 4.0.2. I've just checked again and it does crash 4.0.2. It just takes a few runs, depending on the files in the current directory as it is doing globbing. : *(e:'a=( * )':) seems to be sufficient. I suppose the filename generation code doesn't like being called recursively. Oliver This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ^ permalink raw reply [flat|nested] 5+ messages in thread
* PATCH: fix problem with globs inside (e) glob qualifier 2002-12-19 17:04 ` Oliver Kiddle @ 2003-02-19 18:18 ` Oliver Kiddle 0 siblings, 0 replies; 5+ messages in thread From: Oliver Kiddle @ 2003-02-19 18:18 UTC (permalink / raw) To: zsh-workers On 19 Dec, I wrote: > > I've just checked again and it does crash 4.0.2. It just takes a few > runs, depending on the files in the current directory as it is doing > globbing. > : *(e:'a=( * )':) > seems to be sufficient. I suppose the filename generation code doesn't > like being called recursively. glob.c does contain code for saving and restoring it's state but it was broken in a couple of places. First after saving pathbuf, the saved copy was set to null. Then, in one place the values were not restored. There may be other problems still there due to the save function not reinitialising all the variables. Oliver Index: glob.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/glob.c,v retrieving revision 1.28 diff -u -r1.28 glob.c --- glob.c 5 Aug 2002 12:35:59 -0000 1.28 +++ glob.c 19 Feb 2003 18:09:55 -0000 @@ -181,9 +181,9 @@ (N).gd_pathpos = pathpos; \ (N).gd_pathbuf = pathbuf; \ (N).gd_pathbufsz = 0; \ - (N).gd_pathbuf = NULL; \ (N).gd_glob_pre = glob_pre; \ (N).gd_glob_suf = glob_suf; \ + pathbuf = NULL; \ } while (0) #define restore_globstate(N) \ @@ -234,7 +234,7 @@ } /* stat the filename s appended to pathbuf. l should be true for lstat, * - * false for stat. If st is NULL, the file is only chechked for existance. * + * false for stat. If st is NULL, the file is only checked for existance. * * s == "" is treated as s == ".". This is necessary since on most systems * * foo/ can be used to reference a non-directory foo. Returns nonzero if * * the file does not exists. */ @@ -1580,6 +1580,7 @@ } else if (isset(NOMATCH)) { zerr("no matches found: %s", ostr, 0); free(matchbuf); + restore_globstate(saved); return; } else { /* treat as an ordinary string */ This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-19 18:15 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <6134254DE87BD411908B00A0C99B044F03A0B5AC@MOWD019A> 2002-12-19 12:06 ` Dynamically adding to $mailpath? Oliver Kiddle 2002-12-19 12:44 ` Borzenkov Andrey 2002-12-19 16:10 ` Bart Schaefer 2002-12-19 17:04 ` Oliver Kiddle 2003-02-19 18:18 ` PATCH: fix problem with globs inside (e) glob qualifier Oliver Kiddle
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).