Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diffutils to the trace initcontainer #185

Merged
merged 3 commits into from
Oct 26, 2023
Merged

Conversation

yuvipanda
Copy link
Contributor

Without this, busybox's diff is used and I get the following message about
it not supporting -I:

+ make ARCH=x86 prepare
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/inat.h' differs from latest version at 'arch/x86/include/asm/inat.h'
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/lib/inat.c' differs from latest version at 'arch/x86/lib/inat.c'
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/lib/insn.c' differs from latest version at 'arch/x86/lib/insn.c'
+ find /linux-generic-5.4.144+ -regex '.*\.c\|.*\.txt\|.*Makefile\|.*Build\|.*Kconfig' -type f -delete

real    10m3.441s
user    0m19.081s
sys     0m7.855s
+ rm -rf /usr/src/linux-generic-5.4.144+

real    0m0.001s
user    0m0.001s
sys     0m0.000s
+ mv /linux-generic-5.4.144+ /usr/src

real    0m0.001s
user    0m0.001s
sys     0m0.000s
+ touch /usr/src/linux-generic-5.4.144+/.installed
+ HEADERS_TARGET=/usr/src/linux-generic-5.4.144+
+ mkdir -p /lib/modules/5.4.144+
+ ln -sf /usr/src/linux-generic-5.4.144+ /lib/modules/5.4.144+/source
+ ln -sf /usr/src/linux-generic-5.4.144+ /lib/modules/5.4.144+/build
+ touch /lib/modules/.installed
+ exit 0

@@ -27,7 +27,7 @@ generate_headers()
}

fetch_cos_linux_sources()
{
{S
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{S
{

This seems like a typo @yuvipanda!

@@ -49,7 +49,7 @@ fetch_generic_linux_sources()

echo "Fetching upstream kernel sources for ${kernel_version}."
mkdir -p "${BUILD_DIR}"
curl -sL "https://www.kernel.org/pub/linux/kernel/v${major_version}.x/linux-$kernel_version.tar.gz" \
curl -sSL "https://www.kernel.org/pub/linux/kernel/v${major_version}.x/linux-$kernel_version.tar.gz" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using -S here alongside -s seems fine.

 -s, --silent             Silent mode
 -S, --show-error         Show error even when -s is used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuvipanda this is part of #184 so I figure it should be removed from this PR.

@fntlnz
Copy link
Member

fntlnz commented Jul 27, 2022

@dalehamel PTAL

@yuvipanda
Copy link
Contributor Author

I'm cleaning through my open PRs, and closing this one as there doesn't seem to be much progress. Please do re-open if there is interest in accepting this. Thank you for your wonderful tool!

@yuvipanda yuvipanda closed this Jan 10, 2023
@yuvipanda yuvipanda reopened this Oct 26, 2023
@yuvipanda yuvipanda closed this Oct 26, 2023
@yuvipanda yuvipanda reopened this Oct 26, 2023
@yuvipanda
Copy link
Contributor Author

Unfortunately, I just validated this is still required :( Would love for someone to review and merge this so I can stop having to use my own container image :)

Without this, busybox's `diff` is used and I get the following message about 
it not supporting `-I`:

```
+ make ARCH=x86 prepare
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/inat.h' differs from latest version at 'arch/x86/include/asm/inat.h'
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/lib/inat.c' differs from latest version at 'arch/x86/lib/inat.c'
diff: unrecognized option: I
BusyBox v1.34.1 (2022-04-04 10:19:27 UTC) multi-call binary.

Usage: diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2

Compare files line by line and output the differences between them.
This implementation supports unified diffs only.

        -a      Treat all files as text
        -b      Ignore changes in the amount of whitespace
        -B      Ignore changes whose lines are all blank
        -d      Try hard to find a smaller set of changes
        -i      Ignore case differences
        -L      Use LABEL instead of the filename in the unified header
        -N      Treat absent files as empty
        -q      Output only whether files differ
        -r      Recurse
        --no-dereference Don't follow symlinks
        -S      Start with FILE when comparing directories
        -T      Make tabs line up by prefixing a tab when necessary
        -s      Report when two files are the same
        -t      Expand tabs to spaces in output
        -U      Output LINES lines of context
        -w      Ignore all whitespace
Warning: Kernel ABI header at 'tools/arch/x86/lib/insn.c' differs from latest version at 'arch/x86/lib/insn.c'
+ find /linux-generic-5.4.144+ -regex '.*\.c\|.*\.txt\|.*Makefile\|.*Build\|.*Kconfig' -type f -delete

real    10m3.441s
user    0m19.081s
sys     0m7.855s
+ rm -rf /usr/src/linux-generic-5.4.144+

real    0m0.001s
user    0m0.001s
sys     0m0.000s
+ mv /linux-generic-5.4.144+ /usr/src

real    0m0.001s
user    0m0.001s
sys     0m0.000s
+ touch /usr/src/linux-generic-5.4.144+/.installed
+ HEADERS_TARGET=/usr/src/linux-generic-5.4.144+
+ mkdir -p /lib/modules/5.4.144+
+ ln -sf /usr/src/linux-generic-5.4.144+ /lib/modules/5.4.144+/source
+ ln -sf /usr/src/linux-generic-5.4.144+ /lib/modules/5.4.144+/build
+ touch /lib/modules/.installed
+ exit 0
```
`tar` can't seem to read what is being passed to it without this,
see jupyterhub/mybinder.org-deploy#2171 (comment)
for the error message.
@yuvipanda
Copy link
Contributor Author

I've rebased on latest master and cleaned up.

@fntlnz fntlnz merged commit 478404c into iovisor:master Oct 26, 2023
1 of 4 checks passed
@fntlnz
Copy link
Member

fntlnz commented Oct 26, 2023

Thanks @yuvipanda good catch! 🎉

@yuvipanda
Copy link
Contributor Author

@fntlnz yay that's awesome :)

It looks like the build failed so I don't see a new tag in https://quay.io/repository/iovisor/kubectl-trace-init?tab=tags. Any idea what we can do about that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants