Added a comment

This commit is contained in:
yarikoptic 2020-07-24 15:22:40 +00:00 committed by admin
parent 4ff59a85d5
commit d7e04e5e3a

View file

@ -0,0 +1,66 @@
[[!comment format=mdwn
username="yarikoptic"
avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
subject="comment 1"
date="2020-07-24T15:22:36Z"
content="""
- unsetting `IFS` at top of `runshell` \"fixes\" it but IMHO would not be proper since shell completion etc tools relying on passing it into calls of git etc would be effected.
-
<details><summary>`bash` somehow seems to be also avoiding the segfault:</summary>
```
$> IFS=$'\013' dash /usr/lib/git-annex.linux/git-annex version
[2] 1059479 segmentation fault (core dumped) IFS=$'\013' dash /usr/lib/git-annex.linux/git-annex version
1 9812 ->139 [1].....................................:Fri 24 Jul 2020 11:09:07 AM EDT:.
(git)lena:~/proj/misc/git[master]git
$> IFS=$'\013' posh /usr/lib/git-annex.linux/git-annex version
[2] 1059547 segmentation fault (core dumped) IFS=$'\013' posh /usr/lib/git-annex.linux/git-annex version
1 9813 ->139 [1].....................................:Fri 24 Jul 2020 11:09:12 AM EDT:.
(git)lena:~/proj/misc/git[master]git
$> IFS=$'\013' bash /usr/lib/git-annex.linux/git-annex version
git-annex version: 8.20200617+git192-g5849bd634-1~ndall+1
build flags: Assistant Webapp Pairing S3 WebDAV Inotify DBus DesktopNotify TorrentParser MagicMime Feeds Testsuite
dependency versions: aws-0.20 bloomfilter-2.0.1.0 cryptonite-0.25 DAV-1.3.3 feed-1.0.0.0 ghc-8.4.4 http-client-0.5.13.1 persistent-sqlite-2.8.2 torrent-10000.1.1 uuid-1.3.13 yesod-1.6.0
key/value backends: SHA256E SHA256 SHA512E SHA512 SHA224E SHA224 SHA384E SHA384 SHA3_256E SHA3_256 SHA3_512E SHA3_512 SHA3_224E SHA3_224 SHA3_384E SHA3_384 SKEIN256E SKEIN256 SKEIN512E SKEIN512 BLAKE2B256E BLAKE2B256 BLAKE2B512E BLAKE2B512 BLAKE2B160E BLAKE2B160 BLAKE2B224E BLAKE2B224 BLAKE2B384E BLAKE2B384 BLAKE2BP512E BLAKE2BP512 BLAKE2S256E BLAKE2S256 BLAKE2S160E BLAKE2S160 BLAKE2S224E BLAKE2S224 BLAKE2SP256E BLAKE2SP256 BLAKE2SP224E BLAKE2SP224 SHA1E SHA1 MD5E MD5 WORM URL
remote types: git gcrypt p2p S3 bup directory rsync web bittorrent webdav adb tahoe glacier ddar git-lfs hook external
operating system: linux x86_64
supported repository versions: 8
upgrade supported from repository versions: 0 1 2 3 4 5 6 7
```
</details>
- most likely `runshell` (etc) shims within standalone need to sanitize IFS only when they invoke some tools they use and which rely on IFS, but pass IFS as is into the actual call. It seems that the following patch does the trick
```diff
$> diff -Naur /home/yoh/proj/git-annex/standalone/linux/skel/runshell /usr/lib/git-annex.linux/runshell
--- /home/yoh/proj/git-annex/standalone/linux/skel/runshell 2020-03-08 10:37:15.462465282 -0400
+++ /usr/lib/git-annex.linux/runshell 2020-07-24 11:19:17.707935260 -0400
@@ -4,6 +4,9 @@
set -e
+orig_IFS=\"${IFS:-}\"
+unset IFS
+
os=\"$(uname -o 2>/dev/null || true)\"
base=\"$(dirname \"$0\")\"
@@ -238,6 +241,11 @@
cmd=sh
fi
+if [ -n \"${orig_IFS}\" ]; then
+ IFS=\"${orig_IFS}\"
+ export IFS
+fi
+
if [ -z \"$tbase\" ]; then
if [ \"$useproot\" ]; then
exec proot \"$cmd\" \"$@\"
```
and it seems that git shell completion then still works fine
"""]]