zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [bug] sh: tilde expansion after field splitting
Date: Sun, 8 Oct 2017 13:45:14 -0700	[thread overview]
Message-ID: <171008134514.ZM12272@torch.brasslantern.com> (raw)
In-Reply-To: <20171008202032.11ea7bf9@ntlworld.com>

On Oct 8,  8:20pm, Peter Stephenson wrote:
}
} Good, it sounds like the effect of the chunk you previous identified as
} related was simply moving the linked list node on as a side effect, or
} something like that.

Yes, prior to that previous chunk when stringsubst() did a shwordsplit
the newly created nodes were not properly linked into the original list
of arguments, which is why e.g. mapping history modifiers over the args
didn't work correctly.  Adding them to the list fixed that, but caused
all but the first to be examined twice for SHFILEEXPANSION.

} > - There either isn't a Test/ for the keyvalpairelement() case in the
} >   first hunk below, or it isn't rigorous enough, because I initially
} >   forgot the incnode(node) in that hunk, yet the shell did *not* go
} >   into an infinite loop during "make check", nor did any test
} >   fail
} 
} That doesn't make sense.

I don't know what to tell you; I just now commented it back out and tried
again, and it still works.  I suspect what's happening is that after the
first call to keyvalpairelement() node = insnode is done, and then we
continue around the loop and call keyvalpairelement() a second time on
the same node, at which point it fails and we fall through the rest of
the loop and hit the incnode() at the end, which fixes things.

} > - Grepping Test/* doesn't find anything for SH_FILE_EXPANSION (in
} >   upper/lower, with/without underscores, etc.).  Did I miss it?
} >   Does the test for the case in this thread belong in D04parameter
} >   or E01options?
} 
} Assuming SH_FILE_EXPANSION predates the test suite, I wouldn't be
} surprised if it's missing.

I looked at E01options and found a test there.  It's not quite enough,
obviously, so here's a new one.


diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 8101ff5..6929f51 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -1026,6 +1026,18 @@
 >$lspath $lspath =
 >$lspath
 
+  () {
+    emulate -L sh
+    v='~/one ~/two'
+    print -l -- $v $v
+  }
+0:SH_FILE_EXPANSION option with GLOB_SUBST et al.
+F:Regression test for workers/41811
+>~/one
+>~/two
+>~/one
+>~/two
+
   testpat() {
     if [[ $1 = ${~2} ]]; then print $1 $2 yes; else print $1 $2 no; fi
   }


  reply	other threads:[~2017-10-08 20:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 22:20 Martijn Dekker
2017-10-05  5:24 ` Bart Schaefer
2017-10-08  7:53 ` Bart Schaefer
2017-10-08 19:20   ` Peter Stephenson
2017-10-08 20:45     ` Bart Schaefer [this message]
2017-10-09  8:44       ` Peter Stephenson
2017-10-13  9:43   ` Martijn Dekker
2017-10-13 12:55     ` Peter Stephenson
2017-10-13 15:36       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=171008134514.ZM12272@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).