~sircmpwn/public-inbox

shit: This removes the GNU. v1 PROPOSED

~khm
There are two instances of GNU labeled in the code.  These patches
remove them.  Only apply these patches if you so desire POSIX compliance
that you're willing to suffer for it.

khm (2):
  commit-tree: switch to date -u
  update-index: replace simple stat call with elaborate horse shit

 commit-tree  |  5 ++---
 update-index | 34 ++++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 11 deletions(-)

-- 
2.24.1
The commits created by this patch are reported as having between written
at the epoch by git log.
Oh geesh. Well, the patch is here if anyone wants it. Gonna pass on
upstreaming this one.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/public-inbox/patches/9780/mbox | git am -3
Learn more about email & git

[PATCH shit 1/2] commit-tree: switch to date -u Export this patch

~khm
From: khm <khm@sciops.net>

removes GNUish %z thing, nails timezones to UTC
---
 commit-tree | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/commit-tree b/commit-tree
index bde1ed9..69e8a74 100755
--- a/commit-tree
+++ b/commit-tree
@@ -33,9 +33,8 @@ then
fi
GIT_COMMITTER_NAME=${GIT_COMMITTER_NAME:-$GIT_AUTHOR_NAME}
GIT_COMMITTER_EMAIL=${GIT_COMMITTER_EMAIL:-$GIT_AUTHOR_EMAIL}
# XXX: GNUism
GIT_AUTHOR_DATE=${GIT_AUTHOR_DATE:-$(date +'%s %z')}
GIT_COMMITTER_DATE=${GIT_COMMITTER_DATE:-$(date +'%s %z')}
GIT_AUTHOR_DATE=${GIT_AUTHOR_DATE:-$(date -u +'%s')}
GIT_COMMITTER_DATE=${GIT_COMMITTER_DATE:-$(date -u +'%s')}

printf "tree %s\n" "$tree"
for parent in $parents
-- 
2.24.1
The commits created by this patch are reported as having between written
at the epoch by git log.

[PATCH shit 2/2] update-index: replace simple stat call with elaborate horse shit Export this patch

~khm
From: khm <khm@sciops.net>

this removes the usage of stat(1), which is not defined in posix,
and replaces it with a ton of garbage, which mostly is.

ctime was killed in action, and will be missed.
---
 update-index | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/update-index b/update-index
index c03ace4..fd14d08 100755
--- a/update-index
+++ b/update-index
@@ -12,14 +12,32 @@ write_index_header() (

write_index_file() (
	path="$(normalize_path "$1")"
	stat=$(stat -c "%W %Y %d %i %u %g %s" "$path") # XXX: GNUism
	ctime=$(printf "%s" "$stat" | cut -d' ' -f1)
	mtime=$(printf "%s" "$stat" | cut -d' ' -f2)
	dev=$(printf "%s" "$stat" | cut -d' ' -f3)
	inode=$(printf "%s" "$stat" | cut -d' ' -f4)
	uid=$(printf "%s" "$stat" | cut -d' ' -f5)
	gid=$(printf "%s" "$stat" | cut -d' ' -f6)
	size=$(printf "%s" "$stat" | cut -d' ' -f7)

	# modern posix deprecates both the tar and cpio commands, and replaces
	# them with 'pax' which contains all the functionality of both, for 
	# some ridiculous reason.
	# pax usage ahead, see below if you can't posix
	mtime=$(echo "obase=10; ibase=8;" $(pax -w -d -x cpio -- "$path" | dd 2>/dev/null bs=1 count=11 skip=48) | bc)
	# dev doesn't actually seem to matter as long as dev+ino is always unique
	dev=$(echo "obase=10; ibase=8;" $(pax -w -d -x cpio -- "$path" | dd 2>/dev/null bs=1 count=6 skip=42) | bc)
	# gnu/bsd tar fallback for posix-averse
	# mtime=$(echo "obase=10; ibase=8;"  $(tar --format ustar -cf-  -- "$path" | dd 2>/dev/null bs=1 count=12 skip=136  | tr -d '\0') | bc)
	# dev=$(echo "obase=10; ibase=8;"  $(tar --format ustar -cf-  -- "$path" | dd 2>/dev/null bs=1 count=8 skip=329  | tr -d '\0') | bc)
	# busybox people: your tar is contaminated and you don't have pax. try using cpio(1)?
	# toybox people: you don't have pax either but at least your tar can posix.

	inode=$(ls -i "$path" | awk '{print $1}')
	uid=$(ls -ln "$path" | awk '{print $3}')
	gid=$(ls -ln "$path" | awk '{print $4}')
	size=$(ls -l "$path" | awk '{print $5}')

	# rather than properly handling ctime at all, posix chose to abrogate
	# the issue, but not completely, leaving some references to a ctime
	# definition in the pax extended header, but not actually specifying
	# one.  there is explicitly no posix method for setting ctime, and the
	# only officially-supported method of accessing ctime is with ls -lc,
	# which means you get to parse your locale's ls date/time output.
	ctime=$mtime

	write_int32 "$ctime"
	write_int32 0 # nanoseconds
-- 
2.24.1
Oh geesh. Well, the patch is here if anyone wants it. Gonna pass on
upstreaming this one.
View this thread in the archives