[pacman-dev] [PATCH] srcinfo.sh: remove trailing newline

Denton Liu liu.denton at gmail.com
Mon Jun 8 10:06:16 UTC 2020


Hi Eli,

Sorry for the late reply.

On Wed, Jun 03, 2020 at 08:04:59PM -0400, Eli Schwartz wrote:
> On 6/3/20 7:26 PM, Denton Liu wrote:
> > When the .SRCINFO file is generated via `makepkg --printsrcinfo`, each
> > section is concluded with an empty line. This means that at the end of
> > the file, an empty line remains. When running `git diff --check`, Git
> > will complain about this as a whitespace error, saying "new blank line
> > at EOF."
> 
> git diff --check isn't necessarily our problem, though...
> 
> But it will only be reported once, the very first time you ever commit
> this .SRCINFO

You are correct that it's only reported once. I guess my problem isn't
with `git diff --check` in particular but my problem is that the tool is
generating files that has a whitespace error. (I consider a blank line
at EOF to be an instance of trailing whitespace which should be
considered a whitespace error.)

> > Remove the empty line after sections. Replace the empty echo with a
> > placeholder `true` call in case in the future, we do want to close the
> > section with something.
> 
> Now you've also removed the blank line in the middle of the file,
> separating the pkgbase section from each pkgname section. That is more
> than just the blank line terminating the final pkgname section.

This was intentional. I assumed that the blank line separators were
merely aesthetic since in the wiki, it says "Blank lines [...] are also
ignored." Since the .SRCINFO is supposed to be machine-parsed, I
assumed that the aesthetics didn't really matter and we could follow an
approach similar to how .gitconfig's are laid out with sections squashed
together without any blank lines in between.

Anyway, this is a moot point since downthread, Erich mentioned that he
uses the blank lines in his parsing script and I'd hate to break
backwards compatibility.

If you accept the above justification of a trailing newline at EOF
being a whitespace error, my next reroll of the patch will only remove
the _final_ blank line, not the ones in between.

Thanks for the feedback,

Denton


More information about the pacman-dev mailing list