Subject: Re: Subversion keyword substitution

From: Ludovic Courtès <[email-masked]>
Date: Mon, 27 Mar 2023 11:04:55 +0200

Hi,

Timothy Sample <[email-masked]> skribis:

> Thinking entirely abstractly, the keywords should be expanded.  I’m not
> really long enough in the tooth (old enough) to know how people use
> keywords, but one might be tempted to do something like:
>
>     printf ("This is foo version %s\n", "$Revision$");
>
> If that ever happens, processing the keywords would be very important.

“Very” might be an overstatement.  :-)

In practice, these were typically used in source file headers, so that
if you exported or copied files around (outside version control), they’d
have a timestamp of sorts at the top.

[...]

> It’s not clear to me why SWH passes ‘--ignore-keywords’ to Subversion in
> the first place.  I guess it saves storage, because having identical
> files allows deduplication.

I asked on #swh-devel and the fine folks there hinted at
non-reproducibility.  Looking at
<https://svnbook.red-bean.com/en/1.7/svn.advanced.props.special.keywords.html>,
one thing that’s definitely not reproducible is the “local time zone”
bit.  From that perspective it makes a lot of sense to disable keyword
substitution.

>> How frequent is the use of keywords though?
>
> Well, you found 11 in the current Guix, and I see 30 when I process
> everything I have (from version 1.0 to a few weeks ago).  Furthermore,
> the only usage pattern I see is “$Id” in a comment.

Interesting.

>> So, how about applying the ‘--ignore-keywords’ change and updating
>> hashes accordingly?
>
> It’s probably the right default given the circumstances.

OK.  I’ll submit a patch to that effect, unless you beat me at it.  :-)

> It seems like there’s a direct conflict between ease of packaging and
> ease of time travel.  In the hypothetical case that a keyword mattered,
> it would be a nasty surprise to the package author.  They would have to
> (a) discover the problem and (b) manually do the keyword substitution in
> Scheme (or work around it).

My intuition is that the worst “problem” we might have is ‘--version’
showing unexpanded keywords.

[...]

>> We should remove that recursive flag when it has no effect.  Perhaps we
>> could proceed similarly?
>
> Huh.  My scripts tell me that we haven’t needed it at all in the last
> three years.  That’s a suspicious enough result that I wonder if there’s
> a bug in my scripts.  The results are looking good so far, but there are
> a few things I still need to look over.

Looks like it might be easily addressed!

Thanks,
Ludo’.