]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
ltmain.in: Increase revision limit to 19 digits
authorIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Tue, 28 Jan 2025 14:23:54 +0000 (16:23 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Thu, 13 Feb 2025 15:02:15 +0000 (17:02 +0200)
Current, age, and revision values for a library seem to have been chosen
arbitrarily, which is limiting users to a 5 digit maximum. Now, users
can set revision to at most 19 digits, which is referencing Unix epoch
time in nanoseconds.

Reported: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75880

* build-aux/ltmain.in: Update revision check to allow up to 19 digits.
* tests/versioning.at: Add more version checks to test.
* NEWS: Update.

NEWS
build-aux/ltmain.in
tests/versioning.at

diff --git a/NEWS b/NEWS
index 2412efff29c98e362dbb2464ddd08bd875690b96..71ee0ef94239a88196e2ce0ffa523083061ac063 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ NEWS - list of user-visible changes between releases of GNU Libtool
 
   - Add tagging for Objective-C and Objective-C++, OBJC and OBJCXX.
 
+  - Increase 5 digit limit on revision value for libraries to 19 digits,
+    which is referencing Unix epoch time in nanoseconds.
+
 ** Bug fixes:
 
   - Fix wrongly deduplicated compiler dependencies on linux.
index caec9db292135402f605e0b88889446d566aa400..c59459d05b96fb699a0d2f7a52eb235d2490ec64 100644 (file)
@@ -7177,29 +7177,21 @@ func_mode_link ()
        esac
 
        # Check that each of the things are valid numbers.
-       case $current in
-       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-       *)
-         func_error "CURRENT '$current' must be a nonnegative integer"
+       if echo "$current" | $EGREP -v '(^0$)|(^[1-9]$)|(^[1-9][0-9]{1,4}$)' > /dev/null; then
+         func_error "CURRENT '$current' must be a nonnegative integer and <= 5 digits"
          func_fatal_error "'$vinfo' is not valid version information"
-         ;;
-       esac
+       fi
 
-       case $revision in
-       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-       *)
-         func_error "REVISION '$revision' must be a nonnegative integer"
+       # Currently limiting revision length by Unix epoch time in nanoseconds.
+       if echo "$revision" | $EGREP -v '(^0$)|(^[1-9]$)|(^[1-9][0-9]{1,18}$)' > /dev/null; then
+         func_error "REVISION '$revision' must be a nonnegative integer and <= 19 digits"
          func_fatal_error "'$vinfo' is not valid version information"
-         ;;
-       esac
+       fi
 
-       case $age in
-       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-       *)
-         func_error "AGE '$age' must be a nonnegative integer"
+       if echo "$age" | $EGREP -v '(^0$)|(^[1-9]$)|(^[1-9][0-9]{1,4}$)' > /dev/null; then
+         func_error "AGE '$age' must be a nonnegative integer and <= 5 digits"
          func_fatal_error "'$vinfo' is not valid version information"
-         ;;
-       esac
+       fi
 
        if test "$age" -gt "$current"; then
          func_error "AGE '$age' is greater than the current interface number '$current'"
index 902b0f7d2c431bfcd920d11b6c1455713a062815..0725cef2ff5dc2cb92e2f79f4a18babcfb5fc264 100644 (file)
@@ -120,7 +120,7 @@ done
 # and large ones.
 # TODO: check something like 1001:2419:189 after fixing issues
 # for 'version_type's of 'irix', 'nonstopux', or 'osf'.
-for version_info in 1 1:2 0:0:0 1:1:1 13:241:7; do
+for version_info in 1 1:2 0:0:0 1:1:1 13:241:7 55555:1234567890123456789:55555; do
   AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo ]dnl
           [-version-info $version_info -rpath $libdir], [], [ignore], [ignore])
 done
@@ -131,7 +131,7 @@ AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo ]dnl
 AT_CHECK([$GREP 'AGE.*is greater than' stderr], [], [ignore])
 
 # Hypothesis: we diagnose invalid values.
-for version_info in 1:2:3:4 -1 0:-1 0:0:-1; do
+for version_info in 1:2:3:4 -1 0:-1 0:0:-1 666666:1:1 1:1:666666 0:12345678901234567890:0; do
   AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la liba1.lo ]dnl
           [-version-info $version_info -rpath $libdir], [1], [ignore], [ignore])
 done