[pacman-dev] [PATCH 0/3] makepkg: Alternate implementation of VCS URLs in sources array.
Dave Reisner
d at falconindy.com
Mon Aug 27 20:37:51 EDT 2012
On Mon, Aug 27, 2012 at 08:17:22PM -0400, Luke T.Shumaker wrote:
Ermagerd, snerping...
> I'll give you that awk might be better--but I was never comfortable
> with awk. The problem with IFS that stopped me from using it is that
> it always* will collapse multiple whitespace characters, so it is
> impossible to have an empty column in the middle if useing a ' '
> delimiter. For some reason I was thinking that space was the only safe
> (printable ASCII) character to use--I now realize that both '<' and
> '>' would work fine.
>
> * perhaps there is a shopt option, but I am unaware of it
Yes, this is correct about collapsing empty columns. You can preserve
those empty columns with some hackery, but you cannot split on them. And
yes, this is one case where I would move to awk. It's a lovely little
language that I find to be extremely flexible, and oh gosh readable --
especially when matched up against the likes of sed.
> My use of `readlink` had nothing to do with symlinks; it is simply to
> turn a relative path into an absolute path. An 'unintended' use of
> readlink, but the UNIX authors would say that so is `cat` to display a
> single file is too.
And this is just a result of me not really reading vcsget too closely
when I crafted this reply. If you need an absolute path, just look at
the first character. If its a slash, you're done. If it's not, then
prepend $PWD/.
> I've seen this in several codebases, and is the most reliable method
> of doing this in shell, assuming GNU coreutils.
Yup, but we don't assume that.
> As for quoting rules--I always disliked the 'simpler' rules for '[[',
> the seem like they were trying to compensate for bad programmers, (in
> the first example) I'd have to quote the variable if I were to do a
> similar task with any other command.
Sure... so many bugs in shell boil down to quoting problems, so I'm
actually happy to have one respite here. I've written a _lot_ of shell
over the past 2-3 years.
> ----
>
> Well, I have been taught a few features of Bash, and been made to feel
> like I noob. Thank you, this is learning!
It's not clear that anyone ever _really_ knows shell. Over time, you
just make fewer grevious errors.
More information about the pacman-dev
mailing list