* [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion
@ 2015-05-14 15:45 chris
2015-05-14 19:15 ` Karl Dahlke
2015-05-15 15:42 ` Karl Dahlke
0 siblings, 2 replies; 4+ messages in thread
From: chris @ 2015-05-14 15:45 UTC (permalink / raw)
To: edbrowse-dev
Two reasons, one can probably be surmounted, the other probably cannot.
1. musl, the libc implementation that I use for building the static
executables, lacks GLOB_TILDE_CHECK (and GLOB_TILDE for that matter).
I don't think they're in POSIX.
2. The insurmountable one is that it creates a big inconsistency in the
behavior of commands with respect to filename expansion. Look at the
following typescript to see why.
Script started on Thu 14 May 2015 08:31:42 AM PDT
[chris@mushroom ~]$ edbrowse
do not send referrer
edbrowse ready
$a
hello
.
w ~/foo
cannot create ~/foo
w /home/chris/foo
6
1c
goodbye
.
w ~/foo
8
q
[chris@mushroom ~]$ exit
exit
Script done on Thu 14 May 2015 08:32:26 AM PDT
I'd be happy to submit a patch for review to rework envFile, so that it
does its own ~ and ~username expansion.
Sorry I didn't catch this earlier.
-- Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion
2015-05-14 15:45 [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion chris
@ 2015-05-14 19:15 ` Karl Dahlke
2015-05-15 15:42 ` Karl Dahlke
1 sibling, 0 replies; 4+ messages in thread
From: Karl Dahlke @ 2015-05-14 19:15 UTC (permalink / raw)
To: edbrowse-dev
> lacks GLOB_TILDE_CHECK (and GLOB_TILDE for that matter).
Yeah that's a concern.
> The insurmountable one is that it creates a big inconsistency
Well it's sort of an inconsistency and sort of not.
If you expand foo*bar and there is no match it remains foo*bar.
If you expand ~/foo and there is no match it remains ~/foo.
That is consistent, and how glob works, but it might
not be how you want it to work.
In your defense, the shell expands as you want edbrowse to,
expanding ~ first and then doing the glob.
We can roll our own ~ expansion,
It wouldn't be hard.
I suppose using the getpwent routines and looking for login match
and pasting in the home directory, I think that's what glob does for us,
and I really didn't want to have to do it myself, but whatever.
Let me think about this one for a bit while I finish the code compression project,
which is coming along nicely.
Karl Dahlke
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion
2015-05-14 15:45 [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion chris
2015-05-14 19:15 ` Karl Dahlke
@ 2015-05-15 15:42 ` Karl Dahlke
2015-05-16 7:54 ` chris
1 sibling, 1 reply; 4+ messages in thread
From: Karl Dahlke @ 2015-05-15 15:42 UTC (permalink / raw)
To: edbrowse-dev
Ok, ~user is now under my control, and it behaves like the shell.
It always expands if possible, even if follow-on globbing doesn't match.
This is the same as environment variables; they expand.
This change was easy, about 30 lines of code, with getpwnam doing most of the work.
Karl Dahlke
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion
2015-05-15 15:42 ` Karl Dahlke
@ 2015-05-16 7:54 ` chris
0 siblings, 0 replies; 4+ messages in thread
From: chris @ 2015-05-16 7:54 UTC (permalink / raw)
To: edbrowse-dev
Karl Dahlke <eklhad@comcast.net> writes:
> Ok, ~user is now under my control, and it behaves like the shell.
> It always expands if possible, even if follow-on globbing doesn't match.
Thank you.
With that, the new static binaries are up.
-- Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-16 7:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 15:45 [Edbrowse-dev] we shouldn't be letting glob() do our tilde expansion chris
2015-05-14 19:15 ` Karl Dahlke
2015-05-15 15:42 ` Karl Dahlke
2015-05-16 7:54 ` chris
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).