diff --git a/Build/LinuxMkLibs.hs b/Build/LinuxMkLibs.hs index 3fb757a226..9e829178c7 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 870e0909b9..b1913b9c20 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 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 e09ad8140f..4efa3f8d85 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 0000000000..95fe6cf799 --- /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 73703358d3..886ffd7144 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