Skip to content

Commit

Permalink
Merge branch 'master' into libsolv till 'f267929'
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonIsaac committed Feb 7, 2017
2 parents 8d4a1a5 + f267929 commit fc7b089
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 42 deletions.
36 changes: 15 additions & 21 deletions portmgr/dmg/postflight.in
Expand Up @@ -126,7 +126,7 @@ function delete_old_tcl_package_link {
# delete old link if present
if [[ -e "${OLD_TCL_PACKAGE_DIR}/macports1.0" ]]; then
rm -vrf "${OLD_TCL_PACKAGE_DIR}/macports1.0"
fi
fi

# delete old macports1.0 link from new tcl package dir if present
if [[ -L "${TCL_PACKAGE_PATH}/macports1.0" ]]; then
Expand Down Expand Up @@ -251,41 +251,35 @@ case "${USHELL}" in
;;
esac


# Adding our setting to the PATH variable if not already there:
if "${USHELL}" ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | tr ":" "\n" | grep "^${BINPATH}$" > /dev/null; then
# Run as the $USER: /usr/bin/su $USER -l
# Run a command in the shell: -c "/usr/bin/printenv PATH"
# Only process the last line output (profile may print info): tail -n 1
# Output each path on its own line: tr ":" "\n"
# Look for exactly the BINPATH: grep "^${BINPATH}$"
if /usr/bin/su "${USER}" -l -c "/usr/bin/printenv PATH" | tail -n 1 | tr ":" "\n" | grep "^${BINPATH}$" > /dev/null; then
echo "Your shell already has the right PATH environment variable for use with MacPorts!"
else
write_setting PATH "\"${BINPATH}:${SBINPATH}:\$PATH\""
fi

# We gather the path into a variable of our own for faster operation:
ORIGINAL_MANPATH="$("${USHELL}" ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
# Adding our setting to the MANPATH variable only if it exists:
if ! "${USHELL}" ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
# and following that, if it's not empty:
[[ -z "${ORIGINAL_MANPATH}" ]] || \
# or if it doesn't already contain our path:
echo "${ORIGINAL_MANPATH}" | grep "${MANPAGES}" > /dev/null || \
# or if there's no empty component somewhere in the middle of it:
echo "${ORIGINAL_MANPATH}" | grep :: > /dev/null || \
# or at the start of it:
[[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $1}')" ]] || \
# or at the end of it:
[[ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]]; then
echo "Your shell already has the right MANPATH environment variable for use with MacPorts!"
else
write_setting MANPATH "\"${MANPAGES}:\$MANPATH\""
if /usr/bin/su "${USER}" -l -c "/usr/bin/printenv MANPATH" > /dev/null; then
# check for MANPAGES already in MANPATH
if /usr/bin/su "${USER}" -l -c "/usr/bin/printenv MANPATH" | tail -n 1 | tr ":" "\n" | grep "^${MANPAGES}$" >/dev/null; then
echo "Your shell already has the right MANPATH environment variable for use with MacPorts!"
else
write_setting MANPATH "\"${MANPAGES}:\$MANPATH\""
fi
fi

# Adding a DISPLAY variable only if we're running on Tiger or less and if it doesn't already exist:
if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || "${USHELL}" ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || /usr/bin/su "${USER}" -l -c "/usr/bin/printenv DISPLAY" > /dev/null > /dev/null; then
echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!"
else
write_setting DISPLAY ":0"
fi


# Postflight script is done with its job, update MacPorts and exit gracefully!
update_macports
echo "You have successfully installed the MacPorts system. Launch a terminal and try it out!"
Expand Down
4 changes: 2 additions & 2 deletions src/macports1.0/macports_util.tcl
Expand Up @@ -108,15 +108,15 @@ proc ldindex {varName args} {
set idx [lindex $args 0]
set size [llength $var]
set badrange? 0
if {[string is integer -strict $idx]} {
if {[string is wideinteger -strict $idx]} {
if {$idx < 0 || $idx >= $size} {
set badrange? 1
}
} elseif {$idx eq "end"} {
if {$size == 0} {
set badrange? 1
}
} elseif {[string match "end-*" $idx] && [string is integer -strict [string range $idx 4 end]]} {
} elseif {[string match "end-*" $idx] && [string is wideinteger -strict [string range $idx 4 end]]} {
set i [expr {$size - 1 - [string range $idx 4 end]}]
if {$i < 0 || $i >= $size} {
set badrange? 1
Expand Down
2 changes: 1 addition & 1 deletion src/macports1.0/reclaim.tcl
Expand Up @@ -354,7 +354,7 @@ namespace eval reclaim {

set time [read_last_run_file]

if {![string is integer -strict $time]} {
if {![string is wideinteger -strict $time]} {
return
}

Expand Down
4 changes: 3 additions & 1 deletion src/pextlib1.0/Makefile.in
Expand Up @@ -21,7 +21,6 @@ OBJS= \
setmode.o \
sha1cmd.o \
sha256cmd.o \
sip_copy_proc.o \
strcasecmp.o \
strsed.o \
system.o \
Expand All @@ -30,6 +29,9 @@ OBJS= \
uid.o \
vercomp.o \
xinstall.o
ifeq (@TRACEMODE_SUPPORT@,1)
OBJS+=sip_copy_proc.o
endif
ifneq (@ac_cv_func_strlcat@,yes)
OBJS+=strlcat.o
endif
Expand Down
8 changes: 5 additions & 3 deletions src/pextlib1.0/Pextlib.c
Expand Up @@ -36,14 +36,16 @@
#include <config.h>
#endif

/* required for strdup(3) on Linux and OS X */
#ifndef __APPLE__
/* required for strdup(3) on Linux */
#define _XOPEN_SOURCE 600L
/* required for clearenv(3)/setenv(3)/unsetenv(3) on Linux */
#define _BSD_SOURCE
/* required for clearenv(3)/setenv(3)/unsetenv(3) on OS X */
#define _DARWIN_C_SOURCE
/* required for vasprintf(3) on Linux */
#define _GNU_SOURCE
#endif
/* required for clearenv(3)/setenv(3)/unsetenv(3) on OS X */
#define _DARWIN_C_SOURCE

#include <sys/resource.h>
#include <sys/types.h>
Expand Down
7 changes: 4 additions & 3 deletions src/pextlib1.0/adv-flock.c
Expand Up @@ -33,10 +33,11 @@
#include <config.h>
#endif

/* needed to get struct sigaction on some platforms */
#ifndef __APPLE__
/* needed to get struct sigaction on some platforms, but
hides flock on OS X */
#define _XOPEN_SOURCE 500L
/* the above hides flock on OS X without _DARWIN_C_SOURCE */
#define _DARWIN_C_SOURCE
#endif

#if HAVE_SYS_FILE_H
#include <sys/file.h>
Expand Down
5 changes: 3 additions & 2 deletions src/pextlib1.0/mktemp.c
Expand Up @@ -33,12 +33,13 @@
#include <config.h>
#endif

#ifndef __APPLE__
/* required for strdup(3)/mkdtemp(3) on Linux */
/* hides mkdtemp(3) on OS X */
#define _XOPEN_SOURCE 700L
/* required for mktemp(3) if _XOPEN_SOURCE >= 600L on Linux */
#define _BSD_SOURCE
/* required for mkdtemp(3) on OS X */
#define _DARWIN_C_SOURCE
#endif

#include <errno.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions src/pextlib1.0/realpath.c
Expand Up @@ -35,6 +35,7 @@

/* required for PATH_MAX and realpath(3) */
#define _XOPEN_SOURCE 500
#define _DARWIN_C_SOURCE

#include <tcl.h>

Expand Down
18 changes: 15 additions & 3 deletions src/pextlib1.0/system.c
Expand Up @@ -35,10 +35,11 @@
#include <config.h>
#endif

#ifndef __APPLE__
/* required for fdopen(3)/seteuid(2), among others */
/* hides fgetln(3) on OS X */
#define _XOPEN_SOURCE 600
/* required for fgetln(3) on OS X */
#define _DARWIN_C_SOURCE
#endif

#include <tcl.h>

Expand All @@ -58,9 +59,12 @@
#include <signal.h>

#include "system.h"
#include "sip_copy_proc.h"
#include "Pextlib.h"

#if HAVE_TRACEMODE_SUPPORT
#include "sip_copy_proc.h"
#endif

#if HAVE_CRT_EXTERNS_H
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
Expand Down Expand Up @@ -265,13 +269,21 @@ int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Ob
args[4] = "-c";
args[5] = cmdstring;
args[6] = NULL;
#if HAVE_TRACEMODE_SUPPORT
sip_copy_execve(sandbox_exec_path, args, environ);
#else
execve(sandbox_exec_path, args, environ);
#endif
} else {
args[0] = "sh";
args[1] = "-c";
args[2] = cmdstring;
args[3] = NULL;
#if HAVE_TRACEMODE_SUPPORT
sip_copy_execve("/bin/sh", args, environ);
#else
execve("/bin/sh", args, environ);
#endif
}
exit(128);
/*NOTREACHED*/
Expand Down
4 changes: 2 additions & 2 deletions src/port/port.tcl
Expand Up @@ -5502,7 +5502,7 @@ namespace eval portclient::questions {
throw
}
signal -restart error {TERM INT}
if {($input <= [llength $ports] && [string is integer -strict $input])} {
if {[string is wideinteger -strict $input] && $input <= [llength $ports] && $input > 0} {
return [expr {$input - 1}]
} else {
puts "Please enter an index from the above list."
Expand Down Expand Up @@ -5567,7 +5567,7 @@ namespace eval portclient::questions {

set err_flag 1
foreach num $input {
if {[string is integer -strict $num] && $num <= [llength $ports] && $num > 0} {
if {[string is wideinteger -strict $num] && $num <= [llength $ports] && $num > 0} {
lappend selected_opt [expr {$num -1}]
} elseif {[regexp {(\d+)-(\d+)} $input _ start end]
&& $start <= [llength $ports]
Expand Down
8 changes: 4 additions & 4 deletions src/port1.0/portlint.tcl
Expand Up @@ -426,11 +426,11 @@ proc portlint::lint_main {args} {
}
}

if {![string is integer -strict $epoch]} {
ui_error "Port epoch is not numeric: $epoch"
if {![string is wideinteger -strict $epoch]} {
ui_error "Port epoch is not numeric: $epoch"
incr errors
}
if {![string is integer -strict $revision]} {
if {![string is wideinteger -strict $revision]} {
ui_error "Port revision is not numeric: $revision"
incr errors
}
Expand Down Expand Up @@ -635,7 +635,7 @@ proc portlint::lint_main {args} {
# if the last character of license name is a number or plus sign
# then a hyphen is missing
set license_end [string index $subtest end]
if {"+" eq $license_end || [string is integer -strict $license_end]} {
if {"+" eq $license_end || [string is digit -strict $license_end]} {
ui_error "invalid license '${test}': missing hyphen before version"
incr errors
}
Expand Down

0 comments on commit fc7b089

Please sign in to comment.