prepare-kernel.sh: Remove patch_ed function
PATCH 1/2 prepare-kernel.sh: Remove patch_ed function
The function is unused since 09f8992a55be ("ksrc: rename as kernel").
--- scripts/prepare-kernel.sh | 12 ------------ 1 file changed, 12 deletions(-)
scripts/prepare-kernel.sh +0 -12
@@ -66,18 +66,6 @@ patch_append() { fi } -patch_ed() { - file="$1" - if test "x$output_patch" = "x"; then - ed -s "$linux_tree/$file" > /dev/null - else - if test `check_filter $file` = "ok"; then - patch_copytempfile "$file" - ed -s "$temp_tree/$file" > /dev/null - fi - fi -} - patch_link() { recursive="$1" # "r" or "n" link_file="$2" # "m", "n" or some file (basename) from $target_dir
Signature · 1 line
2.26.2
PATCH 2/2 prepare-kernel.sh: Warn when result can be defective
If the target Linux source tree contains stale files which are owned by Xenomai, the result can be defective. Detect such situations and warn the user to avoid crazy errors.
It happened to me twice that the resulting --outpatch was faulty because my kernel tree contained old Xenomail related files. Hopefully this saves somebody else valuable debug time.
--- scripts/prepare-kernel.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
scripts/prepare-kernel.sh +8 -3
@@ -107,13 +107,18 @@ patch_link() { d=`dirname $f` if test "x$output_patch" = "x"; then mkdir -p $linux_tree/$link_dir/$d - if test x$forcelink = x1 -o \ - ! $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f; - then + if ! test $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f; then + if test -e $linux_tree/$link_dir/$f -a "x$forcelink" != "x1"; then + echo "$me: warning: $link_dir/$f already present in Linux kernel tree, resulting source tree might be inconsistent!" >&2 + continue + fi ln -sf $xenomai_root/$target_dir/$f $linux_tree/$link_dir/$f fi else if test `check_filter $link_dir/$f` = "ok"; then + if test -e $linux_tree/$link_dir/$f; then + echo "$me: warning: $link_dir/$f already present in Linux kernel tree, output patch might be defective" >&2 + fi mkdir -p $temp_tree/$link_dir/$d cp $xenomai_root/$target_dir/$f $temp_tree/$link_dir/$f fi
Signature · 1 line
2.26.2
Re: [PATCH 2/2] prepare-kernel.sh: Warn when result can be defective
Quoted 18 lines · Richard Weinberger
If the target Linux source tree contains stale files which are owned by Xenomai, the result can be defective. Detect such situations and warn the user to avoid crazy errors.
It happened to me twice that the resulting --outpatch was faulty because my kernel tree contained old Xenomail related files. Hopefully this saves somebody else valuable debug time.
Signed-off-by Richard Weinberger <[email protected]>--- scripts/prepare-kernel.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)scripts/prepare-kernel.sh +0
-0
scripts/prepare-kernel.sh patch_link() { · line 113
Quoted 10 lines
scripts/prepare-kernel.sh +4
-3@@ -107,13 +107,18 @@ patch_link() { d=`dirname $f` if test "x$output_patch" = "x"; then mkdir -p $linux_tree/$link_dir/$d - if test x$forcelink = x1 -o \ - ! $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f; - then + if ! test $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f; then + if test -e $linux_tree/$link_dir/$f -a "x$forcelink" != "x1"; then + echo "$me: warning: $link_dir/$f already present in Linux kernel tree, resulting source tree might be inconsistent!" >&2 + continue
Does this actually ever trigger? Aren't we deleting files from the target directory before filling in new ones?
scripts/prepare-kernel.sh patch_link() { · line 121
Quoted 8 lines
scripts/prepare-kernel.sh +4
-0+ fi ln -sf $xenomai_root/$target_dir/$f $linux_tree/$link_dir/$f fi else if test `check_filter $link_dir/$f` = "ok"; then + if test -e $linux_tree/$link_dir/$f; then + echo "$me: warning: $link_dir/$f already present in Linux kernel tree, output patch might be defective" >&2 + fi
This one makes sense to me, though.
scripts/prepare-kernel.sh patch_link() { · line 124
Quoted 3 lines
scripts/prepare-kernel.sh +0
-0mkdir -p $temp_tree/$link_dir/$d cp $xenomai_root/$target_dir/$f $temp_tree/$link_dir/$f fi
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH 2/2] prepare-kernel.sh: Warn when result can be defective
Quoted 25 lines · Jan Kiszka
Quoted 23 lines · Richard Weinberger
If the target Linux source tree contains stale files which are owned by Xenomai, the result can be defective. Detect such situations and warn the user to avoid crazy errors.
It happened to me twice that the resulting --outpatch was faulty because my kernel tree contained old Xenomail related files. Hopefully this saves somebody else valuable debug time.
Signed-off-by Richard Weinberger <[email protected]>--- scripts/prepare-kernel.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)scripts/prepare-kernel.sh +0
-2@@ -107,13 +107,18 @@ patch_link() { d=`dirname $f` if test "x$output_patch" = "x"; then mkdir -p $linux_tree/$link_dir/$d - if test x$forcelink = x1 -o \ - ! $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f;
Quoted 8 lines
scripts/prepare-kernel.sh patch_link() { · line 113
Quoted 5 lines
scripts/prepare-kernel.sh +4
-1- then + if ! test $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f; then + if test -e $linux_tree/$link_dir/$f -a "x$forcelink" != "x1"; then + echo "$me: warning: $link_dir/$f already present in Linux kernel tree, resulting source tree might be inconsistent!" >&2 + continueDoes this actually ever trigger? Aren't we deleting files from the target directory before filling in new ones?
It triggers, e.g.
rw@foxxylove:~/xenomai (prepare_cleanup)> echo zonk > ~/linux/kernel/xenomai/lock.c
rw@foxxylove:~/xenomai (prepare_cleanup)> ./scripts/prepare-kernel.sh --linux=/home/rw/linux --arch=arm64prepare-kernel.sh: warning: kernel/xenomai/lock.c already present in Linux kernel tree, resulting source tree might be inconsistent!
Only when using the --forcelink flag existing files will be overwritten.
Quoted 1 line
This one makes sense to me, though.
Yeah, that one bit me hard.
Thanks,
//richard
Re: [PATCH 2/2] prepare-kernel.sh: Warn when result can be defective
Quoted 43 lines · Richard Weinberger
Quoted 25 lines · Jan Kiszka
Quoted 23 lines · Richard Weinberger
If the target Linux source tree contains stale files which are owned by Xenomai, the result can be defective. Detect such situations and warn the user to avoid crazy errors.
It happened to me twice that the resulting --outpatch was faulty because my kernel tree contained old Xenomail related files. Hopefully this saves somebody else valuable debug time.
Signed-off-by Richard Weinberger <[email protected]>--- scripts/prepare-kernel.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)scripts/prepare-kernel.sh +0
-2@@ -107,13 +107,18 @@ patch_link() { d=`dirname $f` if test "x$output_patch" = "x"; then mkdir -p $linux_tree/$link_dir/$d - if test x$forcelink = x1 -o \ - ! $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f;Quoted 8 lines
scripts/prepare-kernel.sh patch_link() { · line 113
Quoted 5 lines
scripts/prepare-kernel.sh +4
-1- then + if ! test $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f; then + if test -e $linux_tree/$link_dir/$f -a "x$forcelink" != "x1"; then + echo "$me: warning: $link_dir/$f already present in Linux kernel tree, resulting source tree might be inconsistent!" >&2 + continueDoes this actually ever trigger? Aren't we deleting files from the target directory before filling in new ones?
It triggers, e.g.
rw@foxxylove:~/xenomai (prepare_cleanup)> echo zonk >~/linux/kernel/xenomai/lock.c
rw@foxxylove:~/xenomai (prepare_cleanup)>./scripts/prepare-kernel.sh--linux=/home/rw/linux --arch=arm64prepare-kernel.sh: warning:kernel/xenomai/lock.calready present in Linux kernel tree, resulting source tree might be inconsistent!
Quoted 2 lines
Only when using the --forcelink flag existing files will be overwritten.
Nope, the file is overwritten without your patch. Now it is left untouched behind, and the preparation is indeed broken. That's not really an improvement...
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH 2/2] prepare-kernel.sh: Warn when result can be defective
Quoted 8 lines · Jan Kiszka
Quoted 8 lines
It triggers, e.g.
rw@foxxylove:~/xenomai (prepare_cleanup)> echo zonk >~/linux/kernel/xenomai/lock.c
rw@foxxylove:~/xenomai (prepare_cleanup)>./scripts/prepare-kernel.sh--linux=/home/rw/linux --arch=arm64prepare-kernel.sh: warning:kernel/xenomai/lock.calready present in Linux kernel tree, resulting source tree might be inconsistent!
Quoted 6 lines
Quoted 2 lines
Only when using the --forcelink flag existing files will be overwritten.
Nope, the file is overwritten without your patch. Now it is left untouched behind, and the preparation is indeed broken. That's not really an improvement...
Dang, you're right. Just tried myself on the master branch. What is the purpose of --forcelink then?
Signature · 2 lines
Thanks, //richard
Re: [PATCH 2/2] prepare-kernel.sh: Warn when result can be defective
Quoted 12 lines · Richard Weinberger
Quoted 11 lines · Jan Kiszka
Quoted 10 lines
It triggers, e.g.
rw@foxxylove:~/xenomai (prepare_cleanup)> echo zonk >~/linux/kernel/xenomai/lock.c
rw@foxxylove:~/xenomai (prepare_cleanup)>./scripts/prepare-kernel.sh--linux=/home/rw/linux --arch=arm64prepare-kernel.sh: warning:kernel/xenomai/lock.calready present in Linux kernel tree, resulting source tree might be inconsistent!Only when using the --forcelink flag existing files will be overwritten.
Quoted 6 lines
Quoted 3 lines
Nope, the file is overwritten without your patch. Now it is left untouched behind, and the preparation is indeed broken. That's not really an improvement...
Dang, you're right. Just tried myself on the master branch. What is the purpose of --forcelink then?
That will likely remain a mystery. It was once introduced via bc2959c7241f411b15396fa6811fb57213c998ef, but that was under-documented. With 7098866e087e092701034e0b950ef5eb4ea19a0a, I suspect it lost its relevance.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Jan Kiszka
AppliedQuoted 20 lines · Richard Weinberger
The function is unused since
09f8992a55be("ksrc: rename as kernel").Signed-off-by Richard Weinberger <[email protected]>--- scripts/prepare-kernel.sh | 12 ------------ 1 file changed, 12 deletions(-)scripts/prepare-kernel.sh +0
-5@@ -66,18 +66,6 @@ patch_append() { fi } -patch_ed() { - file="$1" - if test "x$output_patch" = "x"; then - ed -s "$linux_tree/$file" > /dev/null - else
scripts/prepare-kernel.sh patch_append() { · line 71
Quoted 10 lines
scripts/prepare-kernel.sh +0
-7- if test `check_filter $file` = "ok"; then - patch_copytempfile "$file" - ed -s "$temp_tree/$file" > /dev/null - fi - fi -} - patch_link() { recursive="$1" # "r" or "n" link_file="$2" # "m", "n" or some file (basename) from $target_dir
Thanks, applied.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center