Skip to contentSkip to conversation

prepare-kernel.sh: Warn when result can be defective

PATCH Applied Richard Weinberger 2 participants 2 messages May 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 when --outpatch is used.
Detect such situations and warn the user to avoid crazy errors.

It happened to me twice that the resulting patch was faulty because my kernel tree contained old Xenomail related files. Hopefully this saves somebody else valuable debug time.

---
v1 tried to be smart in link mode too, but made things worse, this version adds only a warning for outpatch mode which is the use case I'm actually focusing on and initially faced problems.

---
 scripts/prepare-kernel.sh | 3 +++
 1 file changed, 3 insertions(+)
scripts/prepare-kernel.sh +3 -0
index 0b11eca66..b609d9998 100755
@@ -126,6 +126,9 @@ patch_link() {
                 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.35.3
Applied
#1 lore raw
Quoted 23 lines · Richard Weinberger

If the target Linux source tree contains stale files which are owned by Xenomai, the result can be defective when --outpatch is used.
Detect such situations and warn the user to avoid crazy errors.

It happened to me twice that the resulting patch was faulty because my kernel tree contained old Xenomail related files. Hopefully this saves somebody else valuable debug time.

---
v1 tried to be smart in link mode too, but made things worse, this version adds only a warning for outpatch mode which is the use case I'm actually focusing on and initially faced problems.

---
 scripts/prepare-kernel.sh | 3 +++
 1 file changed, 3 insertions(+)
scripts/prepare-kernel.sh +0 -0
index 0b11eca66..b609d9998 100755

scripts/prepare-kernel.sh patch_link() { · line 134

Quoted 9 lines
scripts/prepare-kernel.sh +3 -0
@@ -126,6 +126,9 @@ patch_link() {
                 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

Thanks, applied.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center