-
Notifications
You must be signed in to change notification settings - Fork 601
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
cmd/snap-confine: workaround time_t size differences between architectures #15113
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #15113 +/- ##
==========================================
- Coverage 78.07% 78.07% -0.01%
==========================================
Files 1182 1188 +6
Lines 157743 158027 +284
==========================================
+ Hits 123154 123375 +221
- Misses 26943 26987 +44
- Partials 7646 7665 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
cmd/snap-confine/snap-confine.c
Outdated
@@ -277,7 +278,14 @@ static void log_startup_stage(const char *stage) { | |||
} | |||
struct timeval tv; | |||
gettimeofday(&tv, NULL); | |||
debug("-- snap startup {\"stage\":\"%s\", \"time\":\"%lu.%06lu\"}", stage, tv.tv_sec, tv.tv_usec); | |||
/* TODO ifdef on __TIMESIZE ? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would go to the else if __TIMESIZE is not defined, right? So 32 bits. Is it really the default we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tweaked to #if __TIMESIZE == 32
84cf191
to
d48f15c
Compare
Mon Feb 24 14:24:08 UTC 2025 Failures:Executing:
Restoring:
|
d48f15c
to
6a678fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
cmd/snap-confine/snap-confine.c
Outdated
@@ -277,7 +278,13 @@ static void log_startup_stage(const char *stage) { | |||
} | |||
struct timeval tv; | |||
gettimeofday(&tv, NULL); | |||
debug("-- snap startup {\"stage\":\"%s\", \"time\":\"%lu.%06lu\"}", stage, tv.tv_sec, tv.tv_usec); | |||
#if __TIMESIZE == 32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not sufficient and simple? #15111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebased and updated with explicit int64_t and formatting macros
…tures The following error was observed when building for armhf: snap-confine/snap-confine.c: In function ‘log_startup_stage’: snap-confine/snap-confine.c:280:60: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘__time64_t’ {aka ‘long long int’} [-Werror=format=] 280 | debug("-- snap startup {\"stage\":\"%s\", \"time\":\"%lu.%06lu\"}", stage, tv.tv_sec, tv.tv_usec); | ~~^ ~~~~~~~~~ | | | | long unsigned int __time64_t {aka long long int} | %llu snap-confine/snap-confine.c:280:66: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘__suseconds64_t’ {aka ‘long long int’} [-Werror=format=] 280 | debug("-- snap startup {\"stage\":\"%s\", \"time\":\"%lu.%06lu\"}", stage, tv.tv_sec, tv.tv_usec); | ~~~~^ ~~~~~~~~~~ | | | | long unsigned int __suseconds64_t {aka long long int} | %06llu cc1: all warnings being treated as errors Use proper formatting macros and check for time_t size. Signed-off-by: Maciej Borzecki <[email protected]>
6a678fb
to
df56019
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
The following error was observed when building for armhf:
Use proper formatting macros and check for time_t size.
Thanks for helping us make a better snapd!
Have you signed the license agreement and read the contribution guide?