Skip to content

Conversation

ycongal-smile
Copy link
Contributor

ecodes.c currently contains the kernel info of the build machine and the full path of the input*.h headers: This is not reproducible as output can change even is headers content do not. Downstream distributions might package ecodes.c and get non-reproducible output.

To fix this: introduce a --reproducible option in the build:

  • in setup.py build_ecodes command
  • in underlying genecodes_c.py

Note: These options are disabled by default so no change is expected in current builds.

Here is a sample of the ecodes.c output:

 $ python -m build --config-setting=--build-option='build_ecodes' -n >/dev/null 2>&1; cat src/evdev/ecodes.c |grep Generated
/* Generated on   Linux 6.1.0-31-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07) x86_64 */
/* Generated from ['/usr/include/linux/input.h', '/usr/include/linux/input-event-codes.h', '/usr/include/linux/uinput.h'] */

 $ python -m build --config-setting=--build-option='build_ecodes --reproducibility' -n >/dev/null 2>&1; cat src/evdev/ecodes.c |grep Generated
/* Generated on   hidden for reproducibility */
/* Generated from ['hidden for reproducibility'] */

ecodes.c currently contains the kernel info of the build machine and the
full path of the input*.h headers: This is not reproducible as output
can change even is headers content do not. Downstream distributions
might package ecodes.c and get non-reproducible output.

To fix this: introduce a --reproducible option in the build:
- in setup.py build_ecodes command
- in underlying genecodes_c.py

Note: These options are disabled by default so no change is expected in
current builds.

Signed-off-by: Yoann Congal <[email protected]>
@ssieb
Copy link

ssieb commented Apr 12, 2025

I can see removing the timestamps and kernel version, but not the headers. That's somewhat important info and shouldn't change.

@ycongal-smile
Copy link
Contributor Author

I should have mentioned that I come from the Yocto project (embedded software), in this cross-compiling environment : the targeted headers are not the system headers and come from a very user specific path (often deep in the home of the user). Writing this path to a file cause us reproducibility issue (hence this PR).

@gvalkov gvalkov merged commit 6b4e8ef into gvalkov:main May 1, 2025
8 checks passed
@gvalkov
Copy link
Owner

gvalkov commented May 1, 2025

Thank you for the contribution - I'm happy to hear that this project is being used in Yocto. I hope you don't mind that I changed --reproducibility to --reproducible in b917479.

@ycongal-smile
Copy link
Contributor Author

ycongal-smile commented May 1, 2025

Thank you for the contribution - I'm happy to hear that this project is being used in Yocto. I hope you don't mind that I changed --reproducibility to --reproducible in b917479.

I don't mind at all. I will upgrade to 1.9.2 and switch to --reproducible.
Thanks!

@ycongal-smile ycongal-smile deleted the repro branch May 1, 2025 20:18
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.

3 participants