Fork of Arch Linux devtools from https://git.archlinux.org/devtools.git
Go to file
Luke Shumaker d333440810
lib/common.sh: lock, slock: Allow locks to be inherited.
Allow for locks to be inherited.  Inheriting the lock is something that
mkarchroot could do previously, but has since lost the ability to do.  This
allows for the programs to be more compos-able.

Do this by instead of unconditionally opening $file on $fd, first check if
$file is already open on $fd; and go ahead use it if it is.

The naive way of doing this would be to `$(readlink /dev/fd/$fd)` and
compare that to `$file`.  However, if `$file` is itself a symlink; or there
is a symlink somewhere in the path to `$file`, then this could easily fail.
Instead, check `[[ "/dev/fd/$fd" -ef "$file" ]]`.  Even though the Bash
documentation (`help test`) says that `-ef` checks for if the two files are
hard links to eachother, because it uses stat(3) (which resolves symlinks)
to do this check, it also works with the /dev/fd/ soft links.
2017-04-05 22:03:00 +02:00
lib lib/common.sh: lock, slock: Allow locks to be inherited. 2017-04-05 22:03:00 +02:00
.gitignore Update .gitignore 2013-05-25 22:17:30 +02:00
Makefile Version 20170320 2017-03-20 19:23:50 +01:00
arch-nspawn.in lib/archroot.sh: Simplify check_root 2017-03-07 19:35:09 +01:00
archbuild.in lib/common.sh: add 'lock_close'; use it as appropriate. 2017-04-05 22:03:00 +02:00
archco.in Use repos.archlinux.org everywhere instead of hostname based domains 2016-05-27 21:02:46 +02:00
archrelease.in avoid injecting code into the format string 2013-08-08 21:28:10 +02:00
archrm.in Use double brackets everywhere 2011-12-04 18:00:57 +01:00
bash_completion.in makechrootpkg: Remove add_to_db feature 2013-05-03 04:34:29 +02:00
checkpkg.in checkpkg: mask errors from lib-provides 2014-10-25 11:36:28 -04:00
commitpkg.in Use repos.archlinux.org everywhere instead of hostname based domains 2016-05-27 21:02:46 +02:00
crossrepomove.in Use repos.archlinux.org everywhere instead of hostname based domains 2016-05-27 21:02:46 +02:00
find-libdeps.in find-libdeps: cleanup some quoting/array concerns 2014-10-25 11:36:21 -04:00
finddeps.in Make sure the usage functions are consistent 2012-11-15 15:25:07 +01:00
lddd.in Use #!/bin/bash instead of #!/bin/sh 2011-12-20 23:05:38 +01:00
makechrootpkg.in lib/common.sh: add 'lock_close'; use it as appropriate. 2017-04-05 22:03:00 +02:00
makepkg-i686.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
makepkg-x86_64.conf Set target vendor to pc for usge with gcc 6 2016-05-07 10:53:48 +02:00
mkarchroot.in lib/archroot.sh: Add is_btrfs helper 2017-03-07 20:37:54 +01:00
pacman-extra.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-gnome-unstable.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-kde-unstable.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-multilib-staging.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-multilib-testing.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-multilib.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-staging.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
pacman-testing.conf Update bundled pacman and makepkg configuration 2016-02-07 10:12:56 +01:00
rebuildpkgs.in Use repos.archlinux.org everywhere instead of hostname based domains 2016-05-27 21:02:46 +02:00
zsh_completion.in makechrootpkg: Remove add_to_db feature 2013-05-03 04:34:29 +02:00