develooper Front page | perl.perl5.porters | Postings from July 2011

[perl #93852] [PATCH] `git log --pretty=format:%s HEAD^1..HEAD`

From:
Claes Jacobsson
Date:
July 1, 2011 01:59
Subject:
[perl #93852] [PATCH] `git log --pretty=format:%s HEAD^1..HEAD`
Message ID:
rt-3.6.HEAD-16080-1309465561-658.93852-75-0@perl.org
# New Ticket Created by  Claes Jacobsson 
# Please include the string:  [perl #93852]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=93852 >



Hi,

saw a 0.00 release uploaded today and out of curiosity tried using a negative $VERSION in a module and then C<use Module VERSION> and it reported a 'Invalid version format (non-numeric data)' which is slightly confusing. Attached patch checks if it begings with a dash and then reports a better error. Also updated docs that version is expected to be a positive number.

Cheers,
Claes

This is a bug report for perl from claes@surfar.nu,
generated with the help of perlbug 1.39 running under perl 5.14.1.

>From 0aacb565a79c9b05a1dd963128be2d12b932f714 Mon Sep 17 00:00:00 2001
From: Claes Jakobsson <claes@versed.se>
Date: Thu, 30 Jun 2011 22:09:13 +0200
Subject: [PATCH] Report a better error when trying to use negative version
 numbers instead of 'Invalid version format (non-numeric
 data)' as it currently does. Also update documentation that
 version should be a positive number.

---
 pod/perlmodlib.PL |    2 +-
 util.c            |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/pod/perlmodlib.PL b/pod/perlmodlib.PL
index a82f22f..26f69cb 100644
--- a/pod/perlmodlib.PL
+++ b/pod/perlmodlib.PL
@@ -1328,7 +1328,7 @@ Give the module a version/issue/release number.
 
 To be fully compatible with the Exporter and MakeMaker modules you
 should store your module's version number in a non-my package
-variable called $VERSION.  This should be a floating point
+variable called $VERSION.  This should be a positive floating point
 number with at least two digits after the decimal (i.e., hundredths,
 e.g, C<$VERSION = "0.01">).  Don't use a "1.3.2" style version.
 See L<Exporter> for details.
diff --git a/util.c b/util.c
index 318c965..093b70e 100644
--- a/util.c
+++ b/util.c
@@ -4494,6 +4494,9 @@ dotted_decimal_version:
 	    /* found just an integer */
 	    goto version_prescan_finish;
 	}
+	else if ( *d == '-') {
+		BADVERSION(s,errstr,"Invalid version format (negative version number)");                
+	}
 	else if ( d == s ) {
 	    /* didn't find either integer or period */
 	    BADVERSION(s,errstr,"Invalid version format (non-numeric data)");
-- 
1.7.4.4

---
Flags:
    category=core
    severity=wishlist
---
Site configuration information for perl 5.14.1:

Configured by claes at Mon Jun 27 21:46:28 CEST 2011.

Summary of my perl5 (revision 5 version 14 subversion 1) configuration:
   
  Platform:
    osname=darwin, osvers=10.7.0, archname=darwin-2level
    uname='darwin orion.local 10.7.0 darwin kernel version 10.7.0: sat jan 29 15:17:16 pst 2011; root:xnu-1504.9.37~1release_i386 i386 '
    config_args='-de -Dprefix=/Users/claes/perl5/perlbrew/perls/perl-5.14.1'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-ldbm -ldb -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.14.1:
    /Users/claes/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/darwin-2level
    /Users/claes/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1
    /Users/claes/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/darwin-2level
    /Users/claes/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1
    .

---
Environment for perl 5.14.1:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/claes
    LANG=sv_SE.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/claes/perl5/perlbrew/bin:/Users/claes/perl5/perlbrew/perls/perl-5.14.1/bin:/opt/local/bin:/opt/local/sbin:/usr/local/apache-maven-2.2.1/bin:/Users/claes/bin/:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/erlang/bin:/usr/X11/bin:/opt/local/lib/postgresql83/bin:/opt/local/bin
    PERLBREW_HOME=/Users/claes/.perlbrew
    PERLBREW_PATH=/Users/claes/perl5/perlbrew/bin:/Users/claes/perl5/perlbrew/perls/perl-5.14.1/bin
    PERLBREW_PERL=perl-5.14.1
    PERLBREW_ROOT=/Users/claes/perl5/perlbrew
    PERLBREW_VERSION=0.25
    PERL_BADLANG (unset)
    SHELL=/bin/bash




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About