martijnvanbrummelen / nwipe

nwipe secure disk eraser
GNU General Public License v2.0
682 stars 77 forks source link

timespec not defined #519

Closed xambroz closed 9 months ago

xambroz commented 9 months ago

Hello, on rhel7 (probably also rhel6) there seems to be some issue when the newly used "#define _POSIX_SOURCE" is called before including the , the preprocessor (verified with the -E option) doesn't include the definition of the timespec structure, which then causes the compilation to fail.

https://download.copr.fedorainfracloud.org/results/rebus/infosec/epel-7-x86_64/06596188-nwipe/builder-live.log.gz

gcc -DHAVE_CONFIG_H -I. -I.. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -std=c99 -D_XOPEN_SOURCE=500 -c -o gui.o gui.c gui.c: In function 'nwipe_gui_prng': gui.c:1611:15: warning: unused variable 'tab2' [-Wunused-variable] const int tab2 = 30; ^ gui.c: In function 'nwipe_gui_verify': gui.c:1829:15: warning: unused variable 'tab2' [-Wunused-variable] const int tab2 = 30; ^ gui.c: In function 'nwipe_gui_noblank': gui.c:1998:15: warning: unused variable 'tab2' [-Wunused-variable] const int tab2 = 40; ^ gui.c: In function 'nwipe_gui_add_customer': gui.c:4090:23: warning: unused variable 'setting' [-Wunused-variable] config_setting_t setting; ^ gui.c:4067:15: warning: unused variable 'tab2' [-Wunused-variable] const int tab2 = 27; ^ gui.c: In function 'nwipe_gui_preview_org_customer': gui.c:4729:76: warning: unused variable 'customer_contact_phone' [-Wunused-variable] const char customer_name, customer_address, customer_contact_name, customer_contact_phone; ^ gui.c:4729:52: warning: unused variable 'customer_contact_name' [-Wunused-variable] const char customer_name, customer_address, customer_contact_name, *customer_contact_phone; ^ gui.c:4723:9: warning: variable 'wlines' set but not used [-Wunused-but-set-variable] int wlines; ^ gui.c: In function 'nwipe_gui_set_date_time': gui.c:5066:9: warning: variable 'wcols' set but not used [-Wunused-but-set-variable] int wcols; ^ gui.c:5065:9: warning: variable 'wlines' set but not used [-Wunused-but-set-variable] int wlines; ^ gui.c:5051:15: warning: unused variable 'tab2' [-Wunused-variable] const int tab2 = 27; ^ gui.c: In function 'nwipe_gui_status': gui.c:6128:21: error: storage size of 'tim' isn't known struct timespec tim, tim2; ^ gui.c:6128:26: error: storage size of 'tim2' isn't known struct timespec tim, tim2; ^ gui.c:6128:26: warning: unused variable 'tim2' [-Wunused-variable] gui.c:6128:21: warning: unused variable 'tim' [-Wunused-variable] struct timespec tim, tim2; ^ make[2]: [gui.o] Error 1 make[2]: Waiting for unfinished jobs.... nwipe.c: In function 'signal_hand': nwipe.c:956:10: warning: unused variable 'eta' [-Wunused-variable] char eta[9]; ^ nwipe.c: In function 'check_for_autopoweroff': nwipe.c:1105:9: warning: variable 'r' set but not used [-Wunused-but-set-variable] int r; // A result buffer. ^ make[2]: Leaving directory /builddir/build/BUILD/nwipe-0.35/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/builddir/build/BUILD/nwipe-0.35' make: *** [all] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.UWonsM (%build) Build without this patch Fedora 37-40, RHEL 7/8/9 - fails for RHEL7 https://copr.fedorainfracloud.org/coprs/rebus/infosec/build/6596188/

Build with this patch Fedora 37-40, RHEL 7/8/9 - all OK: https://copr.fedorainfracloud.org/coprs/rebus/infosec/build/6597870/