From: Jarkko Hietaniemi Date: Thu, 28 Oct 1999 13:49:26 +0000 (+0000) Subject: Fix printing of uids and gids; regen Configure. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=785fb66b9a3cb438ed213406a1dec3f5257fd014;p=p5sagit%2Fp5-mst-13.2.git Fix printing of uids and gids; regen Configure. p4raw-id: //depot/cfgperl@4480 --- diff --git a/Configure b/Configure index 5dea797..4a0c191 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Wed Oct 27 21:32:42 EET DST 1999 [metaconfig 3.0 PL70] +# Generated on Thu Oct 28 15:06:20 EET DST 1999 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <&4 +cat > try.c < +#include +int main() { + $gidtype foo = -1; + if (foo < 0) + printf("-1\n"); + else + printf("1\n"); +} +EOCP +set try +if eval $compile; then + yyy=`./try` + case "$yyy" in + '') gidsign=1 + echo "(I can't execute the test program--guessing unsigned.)" >&4 + ;; + *) gidsign=$yyy + case "$gidsign" in + 1) echo "Your $zzz is unsigned." ;; + -1) echo "Your $zzz is signed." ;; + esac + ;; + esac +else + gidsign=1 + echo "(I can't compile the test program--guessing unsigned.)" >&4 +fi + + +echo " " +case "$gidtype" in +*_t) zzz="$gidtype" ;; +*) zzz="gid" ;; +esac +echo "Checking the size of $zzz..." >&4 +cat > try.c < +#include +int main() { + printf("%d\n", sizeof($gidtype)); +} +EOCP +set try +if eval $compile_ok; then + yyy=`./try` + case "$yyy" in + '') gidsize=4 + echo "(I can't execute the test program--guessing $gidsize.)" >&4 + ;; + *) gidsize=$yyy + echo "Your $zzz size is $gidsize bytes." + ;; + esac +else + gidsize=4 + echo "(I can't compile the test program--guessing $gidsize.)" >&4 +fi + + : see if getgroups exists set getgroups d_getgrps eval $inlibc @@ -12578,6 +12648,35 @@ else fi +echo " " +case "$uidtype" in +*_t) zzz="$uidtype" ;; +*) zzz="uid" ;; +esac +echo "Checking the size of $zzz..." >&4 +cat > try.c < +#include +int main() { + printf("%d\n", sizeof($uidtype)); +} +EOCP +set try +if eval $compile_ok; then + yyy=`./try` + case "$yyy" in + '') uidsize=4 + echo "(I can't execute the test program--guessing $uidsize.)" >&4 + ;; + *) uidsize=$yyy + echo "Your $zzz size is $uidsize bytes." + ;; + esac +else + uidsize=4 + echo "(I can't compile the test program--guessing $uidsize.)" >&4 +fi + : see if dbm.h is available : see if dbmclose exists set dbmclose d_dbmclose @@ -13803,6 +13902,8 @@ full_ar='$full_ar' full_csh='$full_csh' full_sed='$full_sed' gccversion='$gccversion' +gidsign='$gidsign' +gidsize='$gidsize' gidtype='$gidtype' glibpth='$glibpth' grep='$grep' @@ -14083,6 +14184,7 @@ tr='$tr' trnl='$trnl' troff='$troff' uidsign='$uidsign' +uidsize='$uidsize' uidtype='$uidtype' uname='$uname' uniq='$uniq' diff --git a/Porting/Glossary b/Porting/Glossary index 5139c7b..9783a11 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -1668,6 +1668,13 @@ gccversion (cc.U): indicate whether the compiler is version 1 or 2. This is used in setting some of the default cflags. It is set to '' if not gcc. +gidsign (gidsign.U): + This variable contains the signedness of a gidtype. + 1 for unsigned, -1 for signed. + +gidsize (gidsize.U): + This variable contains the size of a gidtype in bytes. + gidtype (gidtype.U): This variable defines Gid_t to be something like gid_t, int, ushort, or whatever type is used to declare the return type @@ -3050,6 +3057,9 @@ uidsign (uidsign.U): This variable contains the signedness of a uidtype. 1 for unsigned, -1 for signed. +uidsize (uidsize.U): + This variable contains the size of a uidtype in bytes. + uidtype (uidtype.U): This variable defines Uid_t to be something like uid_t, int, ushort, or whatever type is used to declare user ids in the kernel. diff --git a/Porting/config.sh b/Porting/config.sh index 4090810..f9edd2b 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : . -# Configuration time: Wed Oct 27 21:34:17 EET DST 1999 +# Configuration time: Thu Oct 28 15:12:04 EET DST 1999 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -30,10 +30,10 @@ afs='false' alignbytes='8' ansi2knr='' aphostname='' -apiversion='5.00562' +apiversion='5.00563' ar='ar' -archlib='/opt/perl/lib/5.00562/alpha-dec_osf-thread' -archlibexp='/opt/perl/lib/5.00562/alpha-dec_osf-thread' +archlib='/opt/perl/lib/5.00563/alpha-dec_osf-thread' +archlibexp='/opt/perl/lib/5.00563/alpha-dec_osf-thread' archname64='' archname='alpha-dec_osf-thread' archobjs='' @@ -51,12 +51,12 @@ castflags='0' cat='cat' cc='cc' cccdlflags=' ' -ccdlflags=' -Wl,-rpath,/opt/perl/lib/5.00562/alpha-dec_osf-thread/CORE' +ccdlflags=' -Wl,-rpath,/opt/perl/lib/5.00563/alpha-dec_osf-thread/CORE' ccflags='-pthread -std -DLANGUAGE_C' ccsymbols='__LANGUAGE_C__=1 _LONGLONG=1 LANGUAGE_C=1 SYSTYPE_BSD=1' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Wed Oct 27 21:34:17 EET DST 1999' +cf_time='Thu Oct 28 15:12:04 EET DST 1999' chgrp='' chmod='' chown='' @@ -382,6 +382,8 @@ full_ar='/usr/bin/ar' full_csh='/usr/bin/csh' full_sed='/usr/bin/sed' gccversion='' +gidsign='1' +gidsize='4' gidtype='gid_t' glibpth='/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib' grep='grep' @@ -466,15 +468,15 @@ i_vfork='undef' ignore_versioned_solibs='' incpath='' inews='' -installarchlib='/opt/perl/lib/5.00562/alpha-dec_osf-thread' +installarchlib='/opt/perl/lib/5.00563/alpha-dec_osf-thread' installbin='/opt/perl/bin' installman1dir='/opt/perl/man/man1' installman3dir='/opt/perl/man/man3' installprefix='/opt/perl' installprefixexp='/opt/perl' -installprivlib='/opt/perl/lib/5.00562' +installprivlib='/opt/perl/lib/5.00563' installscript='/opt/perl/bin' -installsitearch='/opt/perl/lib/site_perl/5.00562/alpha-dec_osf-thread' +installsitearch='/opt/perl/lib/site_perl/5.00563/alpha-dec_osf-thread' installsitebin='/opt/perl/bin' installsitelib='/opt/perl/lib/site_perl' installstyle='lib' @@ -570,8 +572,8 @@ pmake='' pr='' prefix='/opt/perl' prefixexp='/opt/perl' -privlib='/opt/perl/lib/5.00562' -privlibexp='/opt/perl/lib/5.00562' +privlib='/opt/perl/lib/5.00563' +privlibexp='/opt/perl/lib/5.00563' prototype='define' ptrsize='8' randbits='48' @@ -615,8 +617,8 @@ sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "EMT", "FPE" sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 6 6 16 20 23 23 23 29 48 ' sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 6, 6, 16, 20, 23, 23, 23, 29, 48, 0' signal_t='void' -sitearch='/opt/perl/lib/site_perl/5.00562/alpha-dec_osf-thread' -sitearchexp='/opt/perl/lib/site_perl/5.00562/alpha-dec_osf-thread' +sitearch='/opt/perl/lib/site_perl/5.00563/alpha-dec_osf-thread' +sitearchexp='/opt/perl/lib/site_perl/5.00563/alpha-dec_osf-thread' sitebin='/opt/perl/bin' sitebinexp='/opt/perl/bin' sitelib='/opt/perl/lib/site_perl' @@ -648,7 +650,7 @@ stdio_ptr='((fp)->_ptr)' stdio_stream_array='_iob' strings='/usr/include/string.h' submit='' -subversion='62' +subversion='63' sysman='/usr/man/man1' tail='' tar='' @@ -662,6 +664,7 @@ tr='tr' trnl='\n' troff='' uidsign='1' +uidsize='4' uidtype='uid_t' uname='uname' uniq='uniq' @@ -690,11 +693,11 @@ vendorlib='' vendorlibexp='' vendorprefix='' vendorprefixexp='' -version='5.00562' +version='5.00563' vi='' voidflags='15' xlibpth='/usr/lib/386 /lib/386' -xs_apiversion='5.00562' +xs_apiversion='5.00563' zcat='' zip='zip' # Configure command line arguments. @@ -714,8 +717,8 @@ config_arg10='-Dmyhostname=yourhost' config_arg11='-dE' PERL_REVISION=5 PERL_VERSION=5 -PERL_SUBVERSION=62 -PERL_APIVERSION=5.00562 +PERL_SUBVERSION=63 +PERL_APIVERSION=5.00563 CONFIGDOTSH=true # Variables propagated from previous config.sh file. pp_sys_cflags='ccflags="$ccflags -DNO_EFF_ONLY_OK"' diff --git a/Porting/config_H b/Porting/config_H index 4f31389..71bee46 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : . - * Configuration time: Wed Oct 27 21:34:17 EET DST 1999 + * Configuration time: Thu Oct 28 15:12:04 EET DST 1999 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -1411,8 +1411,8 @@ * This symbol contains the ~name expanded version of ARCHLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define ARCHLIB "/opt/perl/lib/5.00562/alpha-dec_osf-thread" /**/ -#define ARCHLIB_EXP "/opt/perl/lib/5.00562/alpha-dec_osf-thread" /**/ +#define ARCHLIB "/opt/perl/lib/5.00563/alpha-dec_osf-thread" /**/ +#define ARCHLIB_EXP "/opt/perl/lib/5.00563/alpha-dec_osf-thread" /**/ /* BIN: * This symbol holds the path of the bin directory where the package will @@ -1441,8 +1441,8 @@ * This symbol contains the ~name expanded version of PRIVLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define PRIVLIB "/opt/perl/lib/5.00562" /**/ -#define PRIVLIB_EXP "/opt/perl/lib/5.00562" /**/ +#define PRIVLIB "/opt/perl/lib/5.00563" /**/ +#define PRIVLIB_EXP "/opt/perl/lib/5.00563" /**/ /* SITEARCH: * This symbol contains the name of the private library for this package. @@ -1457,8 +1457,8 @@ * This symbol contains the ~name expanded version of SITEARCH, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define SITEARCH "/opt/perl/lib/site_perl/5.00562/alpha-dec_osf-thread" /**/ -#define SITEARCH_EXP "/opt/perl/lib/site_perl/5.00562/alpha-dec_osf-thread" /**/ +#define SITEARCH "/opt/perl/lib/site_perl/5.00563/alpha-dec_osf-thread" /**/ +#define SITEARCH_EXP "/opt/perl/lib/site_perl/5.00563/alpha-dec_osf-thread" /**/ /* SITELIB: * This symbol contains the name of the private library for this package. @@ -2461,7 +2461,7 @@ /* PERL_XS_APIVERSION: * This variable contains the version of the oldest perl binary * compatible with the present perl. perl.c:incpush() and - * lib/lib.pm will automatically search in /opt/perl/lib/site_perl/5.00562/alpha-dec_osf-thread for older + * lib/lib.pm will automatically search in /opt/perl/lib/site_perl/5.00563/alpha-dec_osf-thread for older * directories across major versions back to xs_apiversion. * This is only useful if you have a perl library directory tree * structured like the default one. @@ -2490,7 +2490,7 @@ * (presumably) be similar. * See the INSTALL file for how this works. */ -#define PERL_XS_APIVERSION 5.00562 /* Change to string for tuples?*/ +#define PERL_XS_APIVERSION 5.00563 /* Change to string for tuples?*/ #define PERL_PM_APIVERSION 5.005 /* Change to string for tuples?*/ /* HAS_DRAND48_PROTO: @@ -2643,6 +2643,17 @@ */ #define Fpos_t fpos_t /* File position type */ +/* Gid_t_SIGN: + * This symbol holds the signedess of a Gid_t. + * 1 for unsigned, -1 for signed. + */ +#define Gid_t_SIGN 1 /* GID sign */ + +/* Gid_t_SIZE: + * This symbol holds the size of a Gid_t in bytes. + */ +#define Gid_t_SIZE 4 /* GID size */ + /* Gid_t: * This symbol holds the return type of getgid() and the type of * argument to setrgid() and related functions. Typically, @@ -2692,6 +2703,11 @@ */ #define Uid_t_SIGN 1 /* UID sign */ +/* Uid_t_SIZE: + * This symbol holds the size of a Uid_t in bytes. + */ +#define Uid_t_SIZE 4 /* UID size */ + /* Uid_t: * This symbol holds the type used to declare user ids in the kernel. * It can be int, ushort, uid_t, etc... It may be necessary to include diff --git a/config_h.SH b/config_h.SH index c7ffd85..25f8f1b 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2657,6 +2657,17 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define Fpos_t $fpostype /* File position type */ +/* Gid_t_SIGN: + * This symbol holds the signedess of a Gid_t. + * 1 for unsigned, -1 for signed. + */ +#define Gid_t_SIGN $gidsign /* GID sign */ + +/* Gid_t_SIZE: + * This symbol holds the size of a Gid_t in bytes. + */ +#define Gid_t_SIZE $gidsize /* GID size */ + /* Gid_t: * This symbol holds the return type of getgid() and the type of * argument to setrgid() and related functions. Typically, @@ -2706,6 +2717,11 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define Uid_t_SIGN $uidsign /* UID sign */ +/* Uid_t_SIZE: + * This symbol holds the size of a Uid_t in bytes. + */ +#define Uid_t_SIZE $uidsize /* UID size */ + /* Uid_t: * This symbol holds the type used to declare user ids in the kernel. * It can be int, ushort, uid_t, etc... It may be necessary to include diff --git a/mg.c b/mg.c index 4cbe0df..eed84f8 100644 --- a/mg.c +++ b/mg.c @@ -656,18 +656,18 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) break; case '(': sv_setiv(sv, (IV)PL_gid); - Perl_sv_setpvf(aTHX_ sv, "%Vd", (IV)PL_gid); + Perl_sv_setpvf(aTHX_ sv, "%"Gid_t_f, PL_gid); goto add_groups; case ')': sv_setiv(sv, (IV)PL_egid); - Perl_sv_setpvf(aTHX_ sv, "%Vd", (IV)PL_egid); + Perl_sv_setpvf(aTHX_ sv, "%"Gid_t_f, PL_egid); add_groups: #ifdef HAS_GETGROUPS { Groups_t gary[NGROUPS]; i = getgroups(NGROUPS,gary); while (--i >= 0) - Perl_sv_catpvf(aTHX_ sv, " %Vd", (IV)gary[i]); + Perl_sv_catpvf(aTHX_ sv, " %"Gid_t_f, gary[i]); } #endif SvIOK_on(sv); /* what a wonderful hack! */ diff --git a/perl.c b/perl.c index c14bfee..8324d52 100644 --- a/perl.c +++ b/perl.c @@ -2352,12 +2352,12 @@ S_validate_suid(pTHX_ char *validarg, char *scriptname, int fdscript) (void)PerlIO_close(PL_rsfp); if (PL_rsfp = PerlProc_popen("/bin/mail root","w")) { /* heh, heh */ PerlIO_printf(PL_rsfp, -"User %ld tried to run dev %ld ino %ld in place of dev %ld ino %ld!\n\ -(Filename of set-id script was %s, uid %ld gid %ld.)\n\nSincerely,\nperl\n", - (long)PL_uid,(long)tmpstatbuf.st_dev, (long)tmpstatbuf.st_ino, +"User %"Uid_t_f" tried to run dev %ld ino %ld in place of dev %ld ino %ld!\n\ +(Filename of set-id script was %s, uid %"Uid_t_f" gid %"Gid_t_f".)\n\nSincerely,\nperl\n", + PL_uid,(long)tmpstatbuf.st_dev, (long)tmpstatbuf.st_ino, (long)PL_statbuf.st_dev, (long)PL_statbuf.st_ino, SvPVX(GvSV(PL_curcop->cop_filegv)), - (long)PL_statbuf.st_uid, (long)PL_statbuf.st_gid); + PL_statbuf.st_uid, PL_statbuf.st_gid); (void)PerlProc_pclose(PL_rsfp); } Perl_croak(aTHX_ "Permission denied\n"); diff --git a/perl.h b/perl.h index 0370634..94bfddb 100644 --- a/perl.h +++ b/perl.h @@ -1950,13 +1950,106 @@ typedef I32 CHECKPOINT; # define UVof PERL_PRIo64 # define UVxf PERL_PRIx64 #else -# if LONGSIZE == 4 +# if IVSIZE == LONGSIZE # define UVuf "lu" # define IVdf "ld" # define UVof "lo" # define UVxf "lx" # else - /* Any good ideas? */ +# if IVSIZE == INTSIZE +# define UVuf "u" +# define IVdf "d" +# define UVof "o" +# define UVxf "x" +# else +# if IVSIZE == SHORTSIZE /* weird */ +# define UVuf "hu" +# define IVdf "hd" +# define UVof "ho" +# define UVxf "hx" +# else + /* well, any good ideas? */ +# endif +# endif +# endif +#endif + +/* The Uid_t_f and Gid_t_f definitely look like a job for metaconfig, + * as do the UVuf, IVdf, UVof, and UVxf above. */ + +#if Uid_t_SIGN == -1 +# if Uid_t_SIZE == IVSIZE +# define Uid_t_f IVdf +# else +# if Uid_t_SIZE == LONGSIZE +# define Uid_t_f "ld" +# else +# if Uid_t_SIZE == INTSIZE +# define Uid_t_f "d" +# else +# if Uid_t_SIZE == SHORTSIZE +# define Uid_t_f "hd" +# else + /* You tell me. */ +# endif +# endif +# endif +# endif +#else +# if Uid_t_SIZE == UVSIZE +# define Uid_t_f UVuf +# else +# if Uid_t_SIZE == LONGSIZE +# define Uid_t_f "lu" +# else +# if Uid_t_SIZE == INTSIZE +# define Uid_t_f "u" +# else +# if Uid_t_SIZE == SHORTSIZE +# define Uid_t_f "hu" +# else + /* You tell me. */ +# endif +# endif +# endif +# endif +#endif + +#if Gid_t_SIGN == -1 +# if Gid_t_SIZE == IVSIZE +# define Gid_t_f IVdf +# else +# if Gid_t_SIZE == LONGSIZE +# define Gid_t_f "ld" +# else +# if Gid_t_SIZE == INTSIZE +# define Gid_t_f "d" +# else +# if Gid_t_SIZE == SHORTSIZE +# define Gid_t_f "hd" +# else + /* You tell me. */ +# endif +# endif +# endif +# endif +#else +# if Gid_t_SIZE == UVSIZE +# define Gid_t_f UVuf +# else +# if Gid_t_SIZE == LONGSIZE +# define Gid_t_f "lu" +# else +# if Gid_t_SIZE == INTSIZE +# define Gid_t_f "u" +# else +# if Gid_t_SIZE == SHORTSIZE +# define Gid_t_f "hu" +# else + /* You tell me. */ +# endif +# endif +# endif # endif #endif diff --git a/taint.c b/taint.c index c0a71cb..24fd487 100644 --- a/taint.c +++ b/taint.c @@ -14,13 +14,8 @@ Perl_taint_proper(pTHX_ const char *f, const char *s) dTHR; /* just for taint */ char *ug; -#if Uid_t_SIGN == -1 DEBUG_u(PerlIO_printf(Perl_debug_log, - "%s %d %"IVdf" %"IVdf"\n", s, PL_tainted, (IV)PL_uid, (IV)PL_euid)); -#else - DEBUG_u(PerlIO_printf(Perl_debug_log, - "%s %d %"UVuf" %"UVuf"\n", s, PL_tainted, (UV)PL_uid, (UV)PL_euid)); -#endif + "%s %d %"Uid_t_f" %"Uid_t_f"\n", s, PL_tainted, PL_uid, PL_euid)); if (PL_tainted) { if (!f)