Subject: Re: bug#75880: relax five-digit maximum on revisions?

From: Ileana Dumitrescu <[email-masked]>
Date: Mon, 27 Jan 2025 21:18:44 +0200

On 27/01/2025 21:04, luigi scarso wrote:
> Unix epoch  expressed in nanosecond is 19 digits:
> $ k=$(date --date='now' +%s%N); printf $k|wc -c
> 19

Here is an updated patch for 19 digits.

-- 
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index caec9db2..c24d3584 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -7177,29 +7177,20 @@ 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]) ;;
-	*)
+	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"
 	  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]) ;;
-	*)
+	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"
 	  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]) ;;
-	*)
+	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"
 	  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'"
diff --git a/tests/versioning.at b/tests/versioning.at
index 902b0f7d..0725cef2 100644
--- a/tests/versioning.at
+++ b/tests/versioning.at
@@ -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