| 1 |
How to implement race-free replacement of a directory by a symlink: |
| 2 |
|
| 3 |
mount -o bind / /tmp/root |
| 4 |
|
| 5 |
mount -o bind /usr/bin /bin |
| 6 |
mv /tmp/root/bin /tmp/root/bin.old |
| 7 |
ln -s usr/bin /tmp/root/bin |
| 8 |
umount /bin |
| 9 |
rm -rf /tmp/root/bin.old |
| 10 |
|
| 11 |
umount /tmp/root |
| 12 |
|
| 13 |
Is this complexity justified just for convert_directory()? |
| 14 |
|
| 15 |
For some operations there are two possible implementations: |
| 16 |
- cp/rename/symlink: slower but race-free |
| 17 |
- rename/symlink: faster (only metadata operations, as long as / and /usr |
| 18 |
are on the same file system) but racy |
| 19 |
|
| 20 |
Is it useful to keep the first implementation if we do not also fix |
| 21 |
the directory-to-symlink races? |
| 22 |
|
| 23 |
How to handle the initramfs check in preinst? |
| 24 |
Is asking a debconf question justified if we suspect that there is no |
| 25 |
initramfs? |
| 26 |
Or should we always ask for confirmation if /usr is a standalone filesystem? |
| 27 |
|