Skip to content

Report failing command in invoke_command()#378

Closed
AllKind wants to merge 1 commit intodkms-project:masterfrom
AllKind:bad_exit_status
Closed

Report failing command in invoke_command()#378
AllKind wants to merge 1 commit intodkms-project:masterfrom
AllKind:bad_exit_status

Conversation

@AllKind
Copy link
Contributor

@AllKind AllKind commented Dec 11, 2023

Report the command that had a bad exit status.
This gives a better picture of what is happening.

Quite often I saw this:

Cleaning build area...(bad exit status: 2)

Which makes one wonder, what actually failed.

With this patch:

Building module:
Cleaning build area...(bad exit status: 2 of: <make -C /lib/modules/6.6.3-100.fc38.x86_64/build M=/var/lib/dkms/zfs/2.2.1/build clean>)

Running the post_build script:
Cleaning build area...(bad exit status: 2 of: <make -C /lib/modules/6.6.3-100.fc38.x86_64/build M=/var/lib/dkms/zfs/2.2.1/build clean>)

@evelikov
Copy link
Collaborator

When verbose is set, the full command is printed as seen in the CI failures. We get it printed twice which is suboptimal.

Can we change this PR to:

  • print the command if it's not already printed aka only on !verbose
  • have the full command on separate line, when there's failure

@AllKind
Copy link
Contributor Author

AllKind commented Dec 11, 2023

Sure. How about this:

Building module:
Cleaning build area...(bad exit status: 2)
Failed command: <make -C /lib/modules/6.6.3-100.fc38.x86_64/build M=/var/lib/dkms/zfs/2.2.1/build clean>
make -j8 KERNELRELEASE=6.6.3-100.fc38.x86_64....................
Signing module /var/lib/dkms/zfs/2.2.1/build/module/zfs.ko
Signing module /var/lib/dkms/zfs/2.2.1/build/module/spl.ko

Running the post_build script:
Cleaning build area...(bad exit status: 2)
Failed command: <make -C /lib/modules/6.6.3-100.fc38.x86_64/build M=/var/lib/dkms/zfs/2.2.1/build clean>

@evelikov
Copy link
Collaborator

Having dealt with all sort of weird terminals, using characters to group/escape the command can be a PITA. Furthermore as we see the build failure below:

Building module:
Cleaning build area...
make -j1 KERNELRELEASE=5.15.142-0-virt all...(bad exit status: 2)
Failed command: <{ make -j1 KERNELRELEASE=5.15.142-0-virt all; } >> /var/lib/dkms/dkms_failing_test/1.0/build/make.log 2>&1>
Error! Bad return status for module build on kernel: 5.15.142-0-virt (x86_64)
Consult /var/lib/dkms/dkms_failing_test/1.0/build/make.log for more information.

Current PR produces this, which quite overwhelming. Is the below something I can bribe you into doing 😅

Building module:
Cleaning build area...(bad exit status: 2)
Failed command:
make -C /lib/modules/6.6.3-100.fc38.x86_64/build M=/var/lib/dkms/zfs/2.2.1/build clean> // using characters (<> or other) can be PITA depending on terminal
Building module(s).........(bad exit status: 2) // change the existing non-verbose message,
Failed command: make -j8 KERNELRELEASE=6.6.3-100.fc38.x86_64 // note: no redirection and friends. might require changing the function/callers
Error! Bad return status for module build on kernel: 6.6.3-100.fc38.x86_64 (x86_64)
Consult /var/lib/dkms/dkms_failing_test/1.0/build/make.log for more information.

@AllKind
Copy link
Contributor Author

AllKind commented Dec 11, 2023

Depends on the bribe... What's your offer? ;-)
I'll take a look tomorrow or the next days.
I hope that will not break too many tests, which would be a PITA too.

@AllKind AllKind force-pushed the bad_exit_status branch 2 times, most recently from c7cfb07 to 4ae2648 Compare December 12, 2023 14:45
Report the command that had a bad exit status.
This gives a better picture of what is happening.
Also slightly re-format the functions output.

Signed-off-by: Mart Frauenlob <AllKind@fastest.cc>
@AllKind
Copy link
Contributor Author

AllKind commented Dec 12, 2023

Okidoki, I tried to implement your requests.
This is what it looks like now:

[vboxadmin@fedora dkms_githubfork]$ sudo dkms add test/dkms_failing_test-1.0
Creating symlink /var/lib/dkms/dkms_failing_test/1.0/source -> /usr/src/dkms_failing_test-1.0

[vboxadmin@fedora dkms_githubfork]$ sudo dkms build dkms_failing_test/1.0
Sign command: /lib/modules/6.6.3-100.fc38.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
Building module(s)...(bad exit status: 2)
Failed command:
make -j8 KERNELRELEASE=6.6.3-100.fc38.x86_64 all
Error! Bad return status for module build on kernel: 6.6.3-100.fc38.x86_64 (x86_64)
Consult /var/lib/dkms/dkms_failing_test/1.0/build/make.log for more information.
[vboxadmin@fedora dkms_githubfork]$ sudo dkms --verbose build dkms_failing_test/1.0
Sign command: /lib/modules/6.6.3-100.fc38.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
make -C /lib/modules/6.6.3-100.fc38.x86_64/build M=/var/lib/dkms/dkms_failing_test/1.0/build clean
make: Entering directory '/usr/src/kernels/6.6.3-100.fc38.x86_64'
make: Leaving directory '/usr/src/kernels/6.6.3-100.fc38.x86_64'

{ make -j8 KERNELRELEASE=6.6.3-100.fc38.x86_64 all; } >> /var/lib/dkms/dkms_failing_test/1.0/build/make.log 2>&1
(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.6.3-100.fc38.x86_64 (x86_64)
Consult /var/lib/dkms/dkms_failing_test/1.0/build/make.log for more information.

Edit: Of course failing_test is now failing...
Edit 2: Also makes other tests fail.

@evelikov
Copy link
Collaborator

I think we can close this as superseded by #380

The latter properly handles the redirection, fixes the tests while also keeping you as co-author in the final patch.

@evelikov evelikov closed this Dec 13, 2023
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.

2 participants