[pacman-dev] [PATCH] makepkg: replace sed in-place with built-in substitution

Eli Schwartz eschwartz at archlinux.org
Wed Nov 6 01:28:03 UTC 2019


On 11/5/19 8:18 PM, Allan McRae wrote:
> On 6/11/19 10:18 am, Ethan Sommer wrote:
>> Read PKGBUILD into an array and replace the pkgver and pkgrel with
>> bash parameter substitution, then use shell redirection to write to to
>> the file. Because shell redirection follows symlinks, this accomplishes
>> the same thing as the previous default of using the GNU-specific
>> --follow-symlinks sed flag.
>>
>> Remove SEDPATH and SEDINPLACEFLAGS from the build systems as they are
>> not used elsewhere.
>> ---
> 
> I like the idea, but am concerned about unintended consequences...
> 
> I saw the following mentioned on IRC:
> - potential for changed line endings

You mean essentially dos2unix? The PKGBUILD would not be valid bash if
it had the wrong type of line endings, bash would attempt to read lots
of $'\r' as actual commands and stuff. That being said, a $'\r' in an
embedded string could break, I suppose.

> - added newline at the end of files without one

I would actually like to force people to have newlines at the end of
their bash files. :(

> - removing any null characters

(I don't actually expect those to exist. The PKGBUILD would have to be
read by something other than makepkg, the only use case offhand I can
think of for embedded null characters in a shell script is those foo.run
installer things which extract a tarball archive from the end of the
script file and then exit before hitting the appended tarball data.)

> I'm leaning on the side of these being fine, but need to mull on it some
> more.
As long as we don't care about embedded $'\r' in string data I *think*
we should be fine.

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20191105/85617637/attachment.sig>


More information about the pacman-dev mailing list