* Another minor =~ glitch
@ 2017-04-07 17:33 Bart Schaefer
2017-04-08 1:58 ` Roland Eggner
0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2017-04-07 17:33 UTC (permalink / raw)
To: zsh-workers
Side note to the REMATCH_PCRE thread: xtrace output shows what's being
done, but it can't be "played back":
torch% set -x
torch% [[ foo =~ .* ]]
+Src/zsh:2> [[ foo -regex-match .* ]]
torch% [[ foo -regex-match .* ]]
+Src/zsh:3> [[zsh: unknown condition: -regex-match
]]
torch%
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another minor =~ glitch
2017-04-07 17:33 Another minor =~ glitch Bart Schaefer
@ 2017-04-08 1:58 ` Roland Eggner
2017-04-08 5:23 ` Bart Schaefer
0 siblings, 1 reply; 6+ messages in thread
From: Roland Eggner @ 2017-04-08 1:58 UTC (permalink / raw)
To: zsh-workers
On 2017-04-07 Fr 10:33:20-0700, Bart Schaefer wrote:
> torch% set -x
> torch% [[ foo =~ .* ]]
> +Src/zsh:2> [[ foo -regex-match .* ]]
> torch% [[ foo -regex-match .* ]]
> +Src/zsh:3> [[zsh: unknown condition: -regex-match
> ]]
> torch%
Regression observed since my Zsh update
from bb6c08b51a079870 to fc1fedda954e1d10.
Similarly using operator “-pcre-match” fails,
using operator “=~” instead works around:
syst% zmodload zsh/pcre
syst% zmodload -F -l zsh/pcre
+b:pcre_compile
+b:pcre_match
+b:pcre_study
+C:pcre-match
syst% setopt RE_MATCH_PCRE XTRACE
syst% [[ "A" -pcre-match "(?i)a" ]]
[[zsh: unknown condition: -pcre-match
]]
syst% [[ "A" =~ "(?i)a" ]] && print y
[[ "A" -pcre-match "(?i)a" ]]
print y
y
syst%
--
Roland Eggner
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another minor =~ glitch
2017-04-08 1:58 ` Roland Eggner
@ 2017-04-08 5:23 ` Bart Schaefer
2017-06-14 4:45 ` Mikael Magnusson
0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2017-04-08 5:23 UTC (permalink / raw)
To: zsh-workers
On Fri, Apr 7, 2017 at 6:58 PM, Roland Eggner <edvz2@systemanalysen.net> wrote:
>
> Regression observed since my Zsh update
> from bb6c08b51a079870 to fc1fedda954e1d10.
Thanks, that narrows it down to this:
diff --git a/Src/cond.c b/Src/cond.c
index 9b739f6..a638412 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -139,9 +139,9 @@ evalcond(Estate state, char *fromtest)
l = 2;
}
if (name && IS_DASH(name[0]))
- errname = name;
+ untokenize(errname = name);
else if (strs[0] && IS_DASH(*strs[0]))
- errname = strs[0];
+ untokenize(errname = strs[0]);
else
errname = "<null>";
if (name && IS_DASH(name[0]) &&
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another minor =~ glitch
2017-04-08 5:23 ` Bart Schaefer
@ 2017-06-14 4:45 ` Mikael Magnusson
2017-06-14 4:49 ` Mikael Magnusson
2017-06-19 10:06 ` PATCH: dupstring a possibly readonly string before modifying Mikael Magnusson
0 siblings, 2 replies; 6+ messages in thread
From: Mikael Magnusson @ 2017-06-14 4:45 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
On Sat, Apr 8, 2017 at 7:23 AM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Fri, Apr 7, 2017 at 6:58 PM, Roland Eggner <edvz2@systemanalysen.net> wrote:
>>
>> Regression observed since my Zsh update
>> from bb6c08b51a079870 to fc1fedda954e1d10.
>
> Thanks, that narrows it down to this:
>
> diff --git a/Src/cond.c b/Src/cond.c
> index 9b739f6..a638412 100644
> --- a/Src/cond.c
> +++ b/Src/cond.c
> @@ -139,9 +139,9 @@ evalcond(Estate state, char *fromtest)
> l = 2;
> }
> if (name && IS_DASH(name[0]))
> - errname = name;
> + untokenize(errname = name);
> else if (strs[0] && IS_DASH(*strs[0]))
> - errname = strs[0];
> + untokenize(errname = strs[0]);
> else
> errname = "<null>";
> if (name && IS_DASH(name[0]) &&
This patch causes segfaults for me (in the first hunk at least)
because name can be a readonly string. Should we ztrdup it?
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Another minor =~ glitch
2017-06-14 4:45 ` Mikael Magnusson
@ 2017-06-14 4:49 ` Mikael Magnusson
2017-06-19 10:06 ` PATCH: dupstring a possibly readonly string before modifying Mikael Magnusson
1 sibling, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2017-06-14 4:49 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
On Wed, Jun 14, 2017 at 6:45 AM, Mikael Magnusson <mikachu@gmail.com> wrote:
> On Sat, Apr 8, 2017 at 7:23 AM, Bart Schaefer <schaefer@brasslantern.com> wrote:
>> On Fri, Apr 7, 2017 at 6:58 PM, Roland Eggner <edvz2@systemanalysen.net> wrote:
>>>
>>> Regression observed since my Zsh update
>>> from bb6c08b51a079870 to fc1fedda954e1d10.
>>
>> Thanks, that narrows it down to this:
>>
>> diff --git a/Src/cond.c b/Src/cond.c
>> index 9b739f6..a638412 100644
>> --- a/Src/cond.c
>> +++ b/Src/cond.c
>> @@ -139,9 +139,9 @@ evalcond(Estate state, char *fromtest)
>> l = 2;
>> }
>> if (name && IS_DASH(name[0]))
>> - errname = name;
>> + untokenize(errname = name);
>> else if (strs[0] && IS_DASH(*strs[0]))
>> - errname = strs[0];
>> + untokenize(errname = strs[0]);
>> else
>> errname = "<null>";
>> if (name && IS_DASH(name[0]) &&
>
> This patch causes segfaults for me (in the first hunk at least)
> because name can be a readonly string. Should we ztrdup it?
(I probably meant dupstring)
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* PATCH: dupstring a possibly readonly string before modifying
2017-06-14 4:45 ` Mikael Magnusson
2017-06-14 4:49 ` Mikael Magnusson
@ 2017-06-19 10:06 ` Mikael Magnusson
1 sibling, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2017-06-19 10:06 UTC (permalink / raw)
To: zsh-workers
---
Src/cond.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Src/cond.c b/Src/cond.c
index a63841234d..b9a47cea54 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -139,7 +139,7 @@ evalcond(Estate state, char *fromtest)
l = 2;
}
if (name && IS_DASH(name[0]))
- untokenize(errname = name);
+ untokenize(errname = dupstring(name));
else if (strs[0] && IS_DASH(*strs[0]))
untokenize(errname = strs[0]);
else
--
2.8.2
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-06-19 10:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 17:33 Another minor =~ glitch Bart Schaefer
2017-04-08 1:58 ` Roland Eggner
2017-04-08 5:23 ` Bart Schaefer
2017-06-14 4:45 ` Mikael Magnusson
2017-06-14 4:49 ` Mikael Magnusson
2017-06-19 10:06 ` PATCH: dupstring a possibly readonly string before modifying Mikael Magnusson
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).