diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-02-16 19:36:26 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-02-16 19:36:26 -0400 |
commit | 4b67ae596a133d285cc28593e26c47e5b14720c3 (patch) | |
tree | a9e9a81cf6f1b9a99db57a50cdcf8ff5a5df178c | |
parent | a7b290e6fa07fc17cdbd058cdaac98bb3f82294f (diff) |
Linux standalone: Improved process names of linker shimmed programs.
-rw-r--r-- | Build/LinuxMkLibs.hs | 29 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/weird_entry_in_process_list.mdwn | 2 | ||||
-rw-r--r-- | doc/bugs/weird_entry_in_process_list/comment_1_61e1fc604b49964ef97f31c9d5546afc._comment | 13 | ||||
-rwxr-xr-x | standalone/linux/skel/runshell | 6 |
5 files changed, 37 insertions, 14 deletions
diff --git a/Build/LinuxMkLibs.hs b/Build/LinuxMkLibs.hs index 3fb757a22..9e829178c 100644 --- a/Build/LinuxMkLibs.hs +++ b/Build/LinuxMkLibs.hs @@ -44,31 +44,40 @@ mklibs top = do -- Various files used by runshell to set up env vars used by the -- linker shims. writeFile (top </> "libdirs") (unlines libdirs) - writeFile (top </> "linker") - (Prelude.head $ filter ("ld-linux" `isInfixOf`) libs') writeFile (top </> "gconvdir") (parentDir $ Prelude.head $ filter ("/gconv/" `isInfixOf`) glibclibs) - mapM_ (installLinkerShim top) exes + let linker = Prelude.head $ filter ("ld-linux" `isInfixOf`) libs' + mapM_ (installLinkerShim top linker) exes {- Installs a linker shim script around a binary. - - Note that each binary is put into its own separate directory, - to avoid eg git looking for binaries in its directory rather - - than in PATH.-} -installLinkerShim :: FilePath -> FilePath -> IO () -installLinkerShim top exe = do - createDirectoryIfMissing True shimdir + - than in PATH. + - + - The linker is symlinked to a file with the same basename as the binary, + - since that looks better in ps than "ld-linux.so". + -} +installLinkerShim :: FilePath -> FilePath -> FilePath -> IO () +installLinkerShim top linker exe = do + createDirectoryIfMissing True (top </> shimdir) + createDirectoryIfMissing True (top </> exedir) renameFile exe exedest + link <- relPathDirToFile (top </> exedir) (top ++ linker) + unlessM (doesFileExist (top </> exelink)) $ + createSymbolicLink link (top </> exelink) writeFile exe $ unlines [ "#!/bin/sh" - , "exec \"$GIT_ANNEX_LINKER\" --library-path \"$GIT_ANNEX_LD_LIBRARY_PATH\" \"$GIT_ANNEX_SHIMMED/" ++ base ++ "/" ++ base ++ "\" \"$@\"" + , "exec \"$GIT_ANNEX_DIR/" ++ exelink ++ "\" --library-path \"$GIT_ANNEX_LD_LIBRARY_PATH\" \"$GIT_ANNEX_DIR/shimmed/" ++ base ++ "/" ++ base ++ "\" \"$@\"" ] modifyFileMode exe $ addModes executeModes where base = takeFileName exe - shimdir = top </> "shimmed" </> base - exedest = shimdir </> base + shimdir = "shimmed" </> base + exedir = "exe" + exedest = top </> shimdir </> base + exelink = exedir </> base {- Converting symlinks to hard links simplifies the binary shimming - process. -} diff --git a/debian/changelog b/debian/changelog index 870e0909b..b1913b9c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -31,6 +31,7 @@ git-annex (5.20150206) UNRELEASED; urgency=medium * sync, assistant: Use the ssh-options git config when doing git pull and push. * remotedaemon: Use the ssh-options git config. + * Linux standalone: Improved process names of linker shimmed programs. -- Joey Hess <id@joeyh.name> Fri, 06 Feb 2015 13:57:08 -0400 diff --git a/doc/bugs/weird_entry_in_process_list.mdwn b/doc/bugs/weird_entry_in_process_list.mdwn index e09ad8140..4efa3f8d8 100644 --- a/doc/bugs/weird_entry_in_process_list.mdwn +++ b/doc/bugs/weird_entry_in_process_list.mdwn @@ -37,3 +37,5 @@ root@koumbit-mp-test:/var/isuma/media/video# ps axf | grep annex """]] couldn't it alter its process name to make this a little more intuitive? This is especially problematic because i am trying to hook git-annex into Puppet and Facter, which require me to guess where the various git-annex repos are on the server. The way i was doing that so far was with `lsof -c 'git-annex' -F0tn`, which is obviously failing under those circumstances.... Unless there's a better way to find those repos across the system? I assume there's a git-annex assistant running here... --[[anarcat]] + +> [[fixed|done]] --[[Joey]] diff --git a/doc/bugs/weird_entry_in_process_list/comment_1_61e1fc604b49964ef97f31c9d5546afc._comment b/doc/bugs/weird_entry_in_process_list/comment_1_61e1fc604b49964ef97f31c9d5546afc._comment new file mode 100644 index 000000000..95fe6cf79 --- /dev/null +++ b/doc/bugs/weird_entry_in_process_list/comment_1_61e1fc604b49964ef97f31c9d5546afc._comment @@ -0,0 +1,13 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2015-02-16T23:35:08Z" + content=""" +Haskell programs actually cannot alter their process name. I've had a bug +open on ghc for a year about that. + +However, I can make a nicer symlink name than ld-linux.so, and use that, +and it will then be clear what program is being run, although the +parameters to it will still be unusual due to the shimming used in the +standalone build. +"""]] diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index 73703358d..886ffd714 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -66,10 +66,8 @@ for lib in $(cat $base/libdirs); do GIT_ANNEX_LD_LIBRARY_PATH="$base/$lib:$GIT_ANNEX_LD_LIBRARY_PATH" done export GIT_ANNEX_LD_LIBRARY_PATH -GIT_ANNEX_LINKER="$base/$(cat $base/linker)" -export GIT_ANNEX_LINKER -GIT_ANNEX_SHIMMED="$base/shimmed" -export GIT_ANNEX_SHIMMED +GIT_ANNEX_DIR="$base" +export GIT_ANNEX_DIR ORIG_GCONV_PATH="$GCONV_PATH" export ORIG_GCONV_PATH |