Giter Site home page Giter Site logo

Comments (6)

anbe42 avatar anbe42 commented on July 16, 2024 2

If you are going to make a PR, you should probably start with adding some tests for mktarball and ldtarball to run_tests.sh. These should cover at least the three use cases source/binary/both. For a start it should be sufficient to look at the "success" cases (whether or not they return 0), tests covering all the possible error paths can come later.

From a sanely behaving mktarball and ldtarball subcommand I'd expect a return value of 0 on success and !0 otherwise.
I'm not sure which error case it tries to signal currently with the return of 1.

(Using sane return values is not something dkms did in the past. But it is getting better.)

from dkms.

evelikov avatar evelikov commented on July 16, 2024

Abstracting ourselves from all the code and implementation details, can you outline a simple reproducer - the more noob friendly the better - the expected behaviour and the actual result you're seeing.

Thanks.

from dkms.

LuKePicci avatar LuKePicci commented on July 16, 2024

Sure, you're welcome.

We have a dkms driver which works fine compiling from sources (fedora 38, x86_64). We would like to avoid the compilation step on a specific device with fixed kernel and distro (fedora 38 as well, x86_64).

We used dkms mktarball with binaries only options to create a prebuilt tar.gz which works fine if we load it using dkms ldtarball and then dkms install -m Mname -v Mversion.

That said, we are now working on packaging such prebuilt driver as RPM package for which we have the following command in the %posttrans hook

%posttrans
/usr/lib/dkms/common.postinst %{module} %{version} $RPM_BUILD_ROOT/usr/modules %{buildarch}

According to the code of common.postinst, when $3 is defined (TARBALL_ROOT, valued /usr/modules at runtime) it is expected to load the driver from a prebuilt tarball with specific file name %{module}-%{version}.dkms.tar.gz and return success status to the rpm package installer.

However, the rpm install fails because common.postinst exits with error from the above line of code. During install, we see the ldtarball command is being executed with right arguments and is printing out normal informational messages to the console but its final exit status makes the if statement at that sae line to take the main branch and thus entering the error condition returned to the rpm package installer.

To reproduce, load and build any dkms module, use mktarball with binaries-only option to create a prebuilt tarball, remove the module from dkms system and then try using the above %posttrans command to install it again. Use echo $? to check the exit status code, you will see it is not 0, as the common.postinst expects.

from dkms.

evelikov avatar evelikov commented on July 16, 2024

If you have done the analysis and can open a MR that would be great. I would request that it includes a test case so we don't regress things.

Alternatively a step-by-step reproducer, as requested earlier is warranted.

from dkms.

anbe42 avatar anbe42 commented on July 16, 2024

Hint: You could use the minimal kernel module from test/dkms_test-1.0/ for the step-by-step reproducer.

from dkms.

LuKePicci avatar LuKePicci commented on July 16, 2024

Great I'll try to make repro steps then. I can also make a PR for the fix but before making a blind fix I would need to ask whoever authored the load_tarball function if it is expected for that function to return 1 in similar invocations. Then I would patch load_tarball rather then common.postinst

from dkms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.