You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "acassis (via GitHub)" <gi...@apache.org> on 2024/03/22 16:08:24 UTC

[PR] libc/uname: Add option to disable uname timestamp [nuttx]

acassis opened a new pull request, #11977:
URL: https://github.com/apache/nuttx/pull/11977

   ## Summary
   Don't include the build timestamp into final binary when the symbol CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP is defined.
   
   ## Impact
   Users will be able to compile same board config twice and get same identical binary.
   
   ## Testing
   stm32f103-minimum:nsh
   
   $ cmp /tmp/nuttx1.bin /tmp/nuttx2.bin
   $
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#discussion_r1535865851


##########
libs/libc/misc/lib_utsname.c:
##########
@@ -93,7 +93,8 @@ int uname(FAR struct utsname *name)
 
   strlcpy(name->release,  CONFIG_VERSION_STRING, sizeof(name->release));
 
-#if defined(__DATE__) && defined(__TIME__)
+#if defined(__DATE__) && defined(__TIME__) && \
+    !defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)

Review Comment:
   Ah ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#issuecomment-2016952049

   > Preferred way to solve this problem is to define SOURCE_DATE_EPOCH in your test driver or build system. Should work at least with modern GCC or Clang as their `__DATE__ `and `__TIME__` handling respects this setting. Refer to: https://reproducible-builds.org/docs/source-date-epoch/
   > 
   > Maybe this patch is good for those NuttX users who use other compilers. Downside of just hiding the time means that users no longer get an indication of "how old" their software is.
   
   Hi @juniskane thank you for this suggestion. About the downside I partly agree, because we can still use the git hash to know when this code was created. Although the user still need to look in the git to get this info, it still there.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "juniskane (via GitHub)" <gi...@apache.org>.
juniskane commented on PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#issuecomment-2016451137

   Preferred way to solve this problem is to define SOURCE_DATE_EPOCH in your test driver or build system. Should work at least with modern GCC or Clang as their `__DATE__ `and `__TIME__` handling respects this setting. Refer to: https://reproducible-builds.org/docs/source-date-epoch/
   
   Maybe this patch is good for those NuttX users who use other compilers. Downside of just hiding the time means that users no longer get an indication of "how old" their software is. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#discussion_r1535881125


##########
libs/libc/misc/lib_utsname.c:
##########
@@ -93,7 +93,8 @@ int uname(FAR struct utsname *name)
 
   strlcpy(name->release,  CONFIG_VERSION_STRING, sizeof(name->release));
 
-#if defined(__DATE__) && defined(__TIME__)
+#if defined(__DATE__) && defined(__TIME__) && \
+    !defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#discussion_r1535856776


##########
libs/libc/misc/lib_utsname.c:
##########
@@ -93,7 +93,8 @@ int uname(FAR struct utsname *name)
 
   strlcpy(name->release,  CONFIG_VERSION_STRING, sizeof(name->release));
 
-#if defined(__DATE__) && defined(__TIME__)
+#if defined(__DATE__) && defined(__TIME__) && \
+    !defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)

Review Comment:
   Hi @xiaoxiang781216 as I commented in the previous PR, doing it there is not ideal, if you run "make clean" and compile again it will generate a new type of binary



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#discussion_r1535858809


##########
libs/libc/misc/lib_utsname.c:
##########
@@ -93,7 +93,8 @@ int uname(FAR struct utsname *name)
 
   strlcpy(name->release,  CONFIG_VERSION_STRING, sizeof(name->release));
 
-#if defined(__DATE__) && defined(__TIME__)
+#if defined(__DATE__) && defined(__TIME__) && \
+    !defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)

Review Comment:
   Yes, I know. My suggestion is adding the check in both place.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #11977:
URL: https://github.com/apache/nuttx/pull/11977#discussion_r1535853588


##########
libs/libc/misc/lib_utsname.c:
##########
@@ -93,7 +93,8 @@ int uname(FAR struct utsname *name)
 
   strlcpy(name->release,  CONFIG_VERSION_STRING, sizeof(name->release));
 
-#if defined(__DATE__) && defined(__TIME__)
+#if defined(__DATE__) && defined(__TIME__) && \
+    !defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)

Review Comment:
   it's better to guard .PHONY target to avoid the unnecessary compiling



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] libc/uname: Add option to disable uname timestamp [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #11977:
URL: https://github.com/apache/nuttx/pull/11977


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org