* [PATCH] inst_symlink: create parent dir if doesn't exist
@ 2012-03-25 22:11 Amadeusz Żołnowski
[not found] ` <1332713513-17889-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Amadeusz Żołnowski @ 2012-03-25 22:11 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Amadeusz Żołnowski
If symlink is yet alone in target directory, inst_symlink will fail to
create it. This is how to reproduce the bug:
# mkdir /tmp/test
# ln -s /bin/cp /tmp/test/cp
# ./dracut -l -f -H /tmp/test.img -I /tmp/test/cp
Result:
[...]
I: *** Including modules done ***
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
I: Wrote /tmp/test.img:
[...]
Following patch creates directory for the symlink if it doesn't exist.
---
dracut-functions.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index f4ccf53..adca47d 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -545,8 +545,11 @@ inst_symlink() {
inst "$_realsrc"
fi
fi
+ set -x
+ [[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
[[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
+ set +x
}
# attempt to install any programs specified in a udev rule
--
1.7.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] inst_symlink: create parent dir if doesn't exist
[not found] ` <1332713513-17889-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
@ 2012-03-26 7:39 ` Amadeusz Żołnowski
2012-03-26 7:39 ` Amadeusz Żołnowski
1 sibling, 0 replies; 3+ messages in thread
From: Amadeusz Żołnowski @ 2012-03-26 7:39 UTC (permalink / raw)
To: initramfs
[-- Attachment #1: Type: text/plain, Size: 444 bytes --]
Excerpts from Amadeusz Żołnowski's message of 2012-03-26 00:11:53 +0200:
> + set -x
> + [[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
> [[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
> ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
> + set +x
Sorry, I have forgot to remove debug. Corrected patch in next post.
--
Amadeusz Żołnowski
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] inst_symlink: create parent dir if doesn't exist
[not found] ` <1332713513-17889-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
2012-03-26 7:39 ` Amadeusz Żołnowski
@ 2012-03-26 7:39 ` Amadeusz Żołnowski
1 sibling, 0 replies; 3+ messages in thread
From: Amadeusz Żołnowski @ 2012-03-26 7:39 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Amadeusz Żołnowski
If symlink is yet alone in target directory, inst_symlink will fail to
create it. This is how to reproduce the bug:
# mkdir /tmp/test
# ln -s /bin/cp /tmp/test/cp
# ./dracut -l -f -H /tmp/test.img -I /tmp/test/cp
Result:
[...]
I: *** Including modules done ***
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
I: Wrote /tmp/test.img:
[...]
Following patch creates directory for the symlink if it doesn't exist.
---
dracut-functions.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index f4ccf53..8082466 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -545,6 +545,7 @@ inst_symlink() {
inst "$_realsrc"
fi
fi
+ [[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
[[ -d ${_target%/*} ]] && _target=$(readlink -f ${_target%/*})/${_target##*/}
ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
}
--
1.7.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-26 7:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-25 22:11 [PATCH] inst_symlink: create parent dir if doesn't exist Amadeusz Żołnowski
[not found] ` <1332713513-17889-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
2012-03-26 7:39 ` Amadeusz Żołnowski
2012-03-26 7:39 ` Amadeusz Żołnowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox