Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bin/package
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,11 @@ then case $(uname) in
esac
fi

# Fix for msys2 because /bin is the same thing as /usr/bin.
if test /bin -ef /usr/bin; then
DEFPATH="/usr/bin:$DEFPATH"
fi
Comment on lines +1793 to +1796

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned this may be the wrong thing, ie for Cygwin, which does the opposite as MSYS2 (it bind mounts /usr/bin to point to /bin). Could we check HOSTTYPE at this point in the script?

Suggested change
# Fix for msys2 because /bin is the same thing as /usr/bin.
if test /bin -ef /usr/bin; then
DEFPATH="/usr/bin:$DEFPATH"
fi
# Fix for msys2 because /bin is the same thing as /usr/bin.
case $HOSTTYPE in
msys.*)
if test /bin -ef /usr/bin; then
DEFPATH="/usr/bin:$DEFPATH"
fi
esac


export DEFPATH # for iffe, etc.

PATH=$(sanitize_PATH "/opt/ast/bin:$DEFPATH:$PATH")
Expand Down Expand Up @@ -2173,7 +2178,7 @@ case $x in
case $KEEP_SHELL in
0) save_PATH=$PATH
PATH=$DEFPATH:$path
for i in ksh ksh93 mksh yash bash sh
for i in sh ksh ksh93 mksh yash bash
do if onpath "$i" && checksh "$_onpath_"
then SHELL=$_onpath_
KEEP_SHELL=1
Expand Down Expand Up @@ -2469,6 +2474,11 @@ checkaout() # cmd ...
$exec $CC -O $CCFLAGS $LDFLAGS -o "$INSTALLROOT/bin/${i}_bootstrap" "$INITROOT/$i.c" || return
$exec ln -sf "${i}_bootstrap" "$INSTALLROOT/bin/$i" || return
;;
msys.*)
# If one is to use the msys2 environment to build ksh93, this must be done instead of how cygwin does it.
$exec $CC -O $CCFLAGS $LDFLAGS -o "$INSTALLROOT/bin/${i}_bootstrap" "$INITROOT/$i.c" || return
MSYS="$MSYS winsymlinks:sys" $exec ln -sf "${i}_bootstrap" "$INSTALLROOT/bin/$i" || return
;;
*) $exec $CC -O $CCFLAGS $LDFLAGS -o "$INSTALLROOT/bin/$i" "$INITROOT/$i.c" || return
;;
esac
Expand Down
1 change: 1 addition & 0 deletions src/cmd/INIT/mamprobe.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
########################################################################
# #
# This software is part of the ast package #
Expand Down
13 changes: 7 additions & 6 deletions src/lib/libast/comp/omitted.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ getuid(void)

if (!convertinit++ && (d = getenv(convertvars[0])))
for (e = environ; s = *e; e++)
if ((n = convert(d, s)) && (m = cygwin_win32_to_posix_path_list_buf_size(s + n)) > 0)
if ((n = convert(d, s)) && (m = conv_path_list_buf_size(s + n), true) > 0)
{
if (!(t = malloc(n + m + 1)))
break;
*e = t;
memcpy(t, s, n);
cygwin_win32_to_posix_path_list(s + n, t + n);
conv_last_list_buf_size(s + n, t + n, false);
}
return sysgetuid();
}
Expand Down Expand Up @@ -557,13 +557,13 @@ runve(int mode, const char* path, char* const* argv, char* const* envv)
#if CONVERT
if (!ux && (d = getenv(convertvars[0])))
for (p = (char**)envv; s = *p; p++)
if ((n = convert(d, s)) && (m = cygwin_posix_to_win32_path_list_buf_size(s + n)) > 0)
if ((n = convert(d, s)) && (m = conv_path_list_buf_size(s + n, true)) > 0)
{
if (!(t = malloc(n + m + 1)))
break;
*p = t;
memcpy(t, s, n);
cygwin_posix_to_win32_path_list(s + n, t + n);
conv_path_list_buf_size(s + n, t + n, false);
}
#endif
}
Expand Down Expand Up @@ -871,7 +871,8 @@ unlink(const char* path)
oerrno = errno;
if (lstat(path, &st) || !S_ISREG(st.st_mode))
goto try_unlink;
cygwin_conv_to_full_win32_path(path, nat);

cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_ABSOLUTE, path, nat, 0);
if (!strncasecmp(nat + 1, ":\\temp\\", 7))
goto try_unlink;
drive = nat[0];
Expand Down Expand Up @@ -1007,7 +1008,7 @@ ctime_now(const char* path)

if (sysstat(path, &fs) || (fs.st_mode & S_IWUSR) || syschmod(path, (fs.st_mode | S_IWUSR) & S_IPERM))
fs.st_mode = 0;
cygwin_conv_to_win32_path(path, tmp);
cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_ABSOLUTE, path, tmp, 0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_ABSOLUTE, path, tmp, 0);
cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_ABSOLUTE, path, tmp, sizeof(tmp));

Similar for the other calls to cygwin_conv_path.

No idea where conv_path_list_buf_size (or conv_last_list_buf_size) come from. But if you need to convert a path list, you can use cygwin_conv_path_list

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it looks like these old deprecated functions were 32-bit only, and removed in cygwin/cygwin@3e917da

hp = CreateFile(tmp, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hp && hp != INVALID_HANDLE_VALUE)
{
Expand Down
10 changes: 7 additions & 3 deletions src/lib/libast/path/pathnative.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@

#if __CYGWIN__

extern void cygwin_conv_to_win32_path(const char*, char*);
#include <sys/cygwin.h>

ssize_t cygwin_conv_path(cygwin_conv_path_t what, const void * from, void * to, size_t size);

size_t
pathnative(const char* path, char* buf, size_t siz)
Expand All @@ -42,15 +44,17 @@ pathnative(const char* path, char* buf, size_t siz)
{
char tmp[PATH_MAX];

cygwin_conv_to_win32_path(path, tmp);
cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_ABSOLUTE, path, tmp, 0);
if ((n = strlen(tmp)) < siz && buf)
memcpy(buf, tmp, n + 1);
return n;
}
cygwin_conv_to_win32_path(path, buf);
cygwin_conv_path(CCP_POSIX_TO_WIN_W | CCP_ABSOLUTE, path, buf, 0);
return strlen(buf);
}



#elif __INTERIX

#include <interix/interix.h>
Expand Down
8 changes: 5 additions & 3 deletions src/lib/libast/path/pathposix.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
#include <ast.h>

#if __CYGWIN__
#include <sys/cygwin.h>

extern void cygwin_conv_to_posix_path(const char*, char*);
ssize_t cygwin_conv_path(cygwin_conv_path_t what, const void * from, void * to, size_t size);

size_t
pathposix(const char* path, char* buf, size_t siz)
Expand All @@ -43,15 +44,16 @@ pathposix(const char* path, char* buf, size_t siz)
{
char tmp[PATH_MAX];

cygwin_conv_to_posix_path(path, tmp);
cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, path, tmp, 0);
if ((n = strlen(tmp)) < siz && buf)
memcpy(buf, tmp, n + 1);
return n;
}
cygwin_conv_to_posix_path(path, buf);
cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, path, buf, 0);
return strlen(buf);
}


#elif __INTERIX

#include <interix/interix.h>
Expand Down