~sircmpwn/public-inbox

2 2

SOURCE_DATE_EPOCH fails on non GNU systems

Stephen Gregoratto
Details
Message ID
<20181122123229.5jahjjl35avadj6z@BlackBox>
DKIM signature
pass
Download raw message
The exporting of SOURCE_DATE_EPOCH in test/preamble:73 fails on systems 
where the date command does not implement the '-d' flag. Moreover the 
only portable way to set a common date is to use:
	UNIX timestamp -> Format (e.g. "%F")
and not:
	Format -> UNIX timestamp

The relevant parsing code is at src/main.c:71,80.

Some ways this could be fixed:
1. Change the date string to a UNIX timestamp, change the output format 
to something different and parse that different format.
2. Change the date string to a timestamp, change the format to %F and 
copy it directly to the date buffer.

Both of these would use the example outlined here[1]:
I'd go with number 2, as it seems the simplest to implement.

[1] https://reproducible-builds.org/docs/source-date-epoch/

-- 
PGP Fingerprint: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
Need my PGP key? Get it from pgp.mit.edu using:
	gpg --keyserver pgp.mit.edu --recv-keys 8BABEC8B
or grab it off my server at https://www.sgregoratto.me/pubkey.txt
Details
Message ID
<20181122152305.GA1508@homura.localdomain>
In-Reply-To
<20181122123229.5jahjjl35avadj6z@BlackBox> (view parent)
DKIM signature
permerror
Download raw message
On 2018-11-22 11:32 PM, Stephen Gregoratto wrote:
> 2. Change the date string to a timestamp, change the format to %F and 
> copy it directly to the date buffer.
> 
> Both of these would use the example outlined here[1]:
> I'd go with number 2, as it seems the simplest to implement.

I agree
Stephen Gregoratto
Details
Message ID
<20181123023630.ykxjjqhudtfkq7ho@BlackBox>
In-Reply-To
<20181122152305.GA1508@homura.localdomain> (view parent)
DKIM signature
pass
Download raw message
Actually, I've encountered some problems on the *BSDs to make me think 
both of these are hard to do. Better to set SOURCE_DATE_EPOCH to a UNIX 
timestamp (in this case 1512879537) rather than get the value from date.
I also think that SOURCE_DATE_EPOCH should be documented in scdoc(1), as 
it does influence the program's output.

Also, I've run the test scripts through shellcheck and it picked up some 
errors. Would you like me to squash all the changes together or split 
them into different patchsets?

-- 
Stephen Gregoratto
PGP Fingerprint: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
Need my PGP key? Get it from pgp.mit.edu using:
	gpg --keyserver pgp.mit.edu --recv-keys 8BABEC8B
or grab it off my server at https://www.sgregoratto.me/pubkey.txt