Control: retitle -1 mount: umount bash completion explodes when HOME/PWD 
contains [a-b] in path
Control: tags -1 + confirmed

On Sat, Sep 03, 2022 at 08:30:15PM +0200, наб wrote:
[...]
> -- >8 --
> 
> Which I gamed down to:
> -- >8 --
> $ echo | gawk '{print ($0 ~ "[n-2]")}'
> gawk: cmd. line:1: (FILENAME=- FNR=1) fatal: invalid regexp: Invalid range 
> end: /[n-2]/
> $ echo | mawk '{print ($0 ~ "[n-2]")}'
> 0
> -- >8 --
> 
> So the solution seems to be "don't use paths as regexes lmao".
> The correct spelling of that check would be
>   substr($0, 0, length(ENVIRON["PWD"])) == ENVIRON["PWD"]
> and of the subsequent string manipulation as 
>   reldir = substr($0, length(ENVIRON["PWD"]) + 1)
>   sub("^/", "", reldir)
> for the second branch and
>   substr($0, 0, length(ENVIRON["HOME"])) == ENVIRON["HOME"]
> with
>   homeless = "~" substr($0, length(ENVIRON["HOME"]) + 1)
> for the first (checked on mawk and gawk).
> 
> Best,
> наб

Thanks for narrowing this down. Could you please submit your findings
to the upstream mailing list? (util-linux at vger.kernel.org)

(I've confirmed I can reproduce this. Also making bug title more
specific while at it.)

Regards,
Andreas Henriksson

Reply via email to