1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-04-03 20:12:58 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Nick Briggs
b5f51d58f1 Correct missing htons() on port number for TCPop connect 2022-06-03 18:32:36 -07:00
Nick Briggs
60af445afa If SHELL is not set, fall back to /bin/sh so CHAT(SHELL) might work. (#424) 2022-05-28 12:37:43 -07:00
Nick Briggs
a18f09d788 Create missing directories when opening directory/file on {UNIX} device for output (#422)
Prior to this change there was no mechanism within Medley to create a new directory
on a {UNIX} style device.  This change makes the {UNIX} directory creation happen in
the same manner that {DSK} directory creation is done.  Opening a file with access
OUTPUT, BOTH, or APPEND, which would create the file if it does not exist, will also
create any missing directories in the path.
2022-05-24 16:08:26 -07:00
Nick Briggs
2bf7047709 Correct usage of stat.st_mode result for testing S_IFREG and S_IFDIR (#421)
stat.st_mode cannot be tested for whether a node is S_IFDIR with
    if (stat.st_mode & S_IFDIR) ...
since S_IFDIR bit (0040000) is a subset of S_IFSOCK (0140000) bits.
A correct check is
    if ((stat.st_mode & S_IFMT) == S_IFDIR) ...
or alternatively, since the convenience macros are defined on all modern systems
    if (S_ISDIR(stat.st_mode)) ...
2022-03-29 18:15:21 -07:00
Nick Briggs
90b967c8d3 Implement DELFILE for (empty) directories on the {unix} device (#409)
If the argument to DELFILE represents a directory on the {unix} device
either directly or through resolving to a full pathname via the connected
host/directory, and the directory is empty, then the directory will be deleted
and the deleted directory name will be returned.  Will error if the
directory is not empty, and return NIL if the argument does not name a directory
or file.
2022-03-18 18:20:35 -07:00
Frank Halasz
b005501427 Cosmetic fix: Use DOCKER_NAMESPACE instead of DOCKER_OWNER in workflows. Matches the corresponding change in Medley workflows (where it was more than cosmetic). (#419) 2022-02-12 18:04:36 -08:00
Frank Halasz
20046b265b Taking source builds out of buildReleaseInclDocker workflow (#418)
Github does this automatically when release published
2022-02-12 13:44:50 -08:00
6 changed files with 48 additions and 98 deletions

View File

@@ -8,7 +8,8 @@
# For macOS: release assets are built/pushed for X86_64. (No aarch64 as yet.)
# For Windows: not supported
#
# Note release pushed to github also includes source code assets in tar and zip formats.
# Note release pushed to github automatically includes source code assets
# in tar and zip formats.
#
# 2022-01-16 by Frank Halasz based on earlier workflow called buildDocker.yml
#
@@ -54,15 +55,13 @@ defaults:
run:
shell: bash
# 3 separate jobs here that can run in parallel
# 2 separate jobs here that can run in parallel
#
# 1. Linux: Build/push a multiplatform Linux Docker image and use results to
# build/push Linux release assets.
#
# 2. MacOs_x86_64: Build maiko for MacOS on X86_64 then create and push release assets.
#
# 3. Sources: create/push sources assets for this release.
#
jobs:
@@ -149,9 +148,9 @@ jobs:
- name: Setup Docker Environment Variables
id: docker_env
run: |
DOCKER_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "DOCKER_OWNER=${DOCKER_OWNER}" >> ${GITHUB_ENV}
DOCKER_IMAGE=${DOCKER_OWNER}/${{ steps.tag.outputs.repo_name }}
DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "DOCKER_NAMESPACE=${DOCKER_NAMESPACE}" >> ${GITHUB_ENV}
DOCKER_IMAGE=${DOCKER_NAMESPACE}/${{ steps.tag.outputs.repo_name }}
DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}"
echo ::set-output name=build_time::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=docker_tags::${DOCKER_TAGS}
@@ -319,62 +318,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
######################################################################################
# Sources: create and push release assets containing sources to github
sources:
needs: [inputs, sentry]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
runs-on: ubuntu-latest
steps:
# Checkout the branch
- name: Checkout
uses: actions/checkout@v2
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v2
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
# Setup release tag
- name: Setup Release Tag
id: tag
uses: ./../actions/release-tag-action
# Create source tars for the release
- name: Make source tars
env:
RELEASE_TAG: ${{ steps.tag.outputs.release_tag }}
run: |
mkdir -p /tmp/release_tars
pushd ${GITHUB_WORKSPACE}/../ >/dev/null
mv maiko ${RELEASE_TAG}
/usr/bin/tar -c -z -f /tmp/release_tars/${RELEASE_TAG}-source.tgz --exclude=.git ${RELEASE_TAG}
/usr/bin/find ${RELEASE_TAG} -name .git -prune -o -print |\
/usr/bin/zip -@ /tmp/release_tars/${RELEASE_TAG}-source.zip
mv ${RELEASE_TAG} maiko
popd >/dev/null
# Push Release
- name: Push the release
uses: ncipollo/release-action@v1.8.10
with:
allowUpdates: true
artifacts:
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-source.tgz,
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-source.zip
tag: ${{ steps.tag.outputs.release_tag }}
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
######################################################################################
@@ -388,7 +331,7 @@ jobs:
outputs:
build_successful: ${{ steps.output.outputs.build_successful }}
needs: [inputs, sentry, linux, macos_x86_64, sources]
needs: [inputs, sentry, linux, macos_x86_64]
steps:
# Checkout the actions for this repo owner

View File

@@ -522,7 +522,7 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -659,7 +659,7 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dp->d_name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -800,7 +800,7 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dirp.name); /* moved from below 2/26/93 */
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -922,7 +922,7 @@ static int enum_dsk(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dp->d_name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -1025,7 +1025,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -1117,7 +1117,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dp->d_name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -1224,7 +1224,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dirp.name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);
@@ -1300,7 +1300,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
}
strcpy(namebuf, dp->d_name);
if (sbuf.st_mode & S_IFDIR) {
if (S_ISDIR(sbuf.st_mode)) {
nextp->dirp = 1;
quote_dname(namebuf);
strcpy(nextp->lname, namebuf);

View File

@@ -327,29 +327,23 @@ LispPTR COM_openfile(register LispPTR *args)
case ACCESS_OUTPUT:
flags = O_RDWR | O_TRUNC | O_CREAT;
if (dskp) {
unpack_filename(file, dir, name, ver, 1);
if (make_directory(dir) == 0) return (NIL);
link_check_flg = 1;
}
unpack_filename(file, dir, name, ver, 1);
if (make_directory(dir) == 0) return (NIL);
if (dskp) link_check_flg = 1;
break;
case ACCESS_BOTH:
flags = O_RDWR | O_CREAT;
if (dskp) {
unpack_filename(file, dir, name, ver, 1);
if (make_directory(dir) == 0) return (NIL);
link_check_flg = 1;
}
unpack_filename(file, dir, name, ver, 1);
if (make_directory(dir) == 0) return (NIL);
if (dskp) link_check_flg = 1;
break;
case ACCESS_APPEND:
flags = O_RDWR | O_CREAT;
if (dskp) {
unpack_filename(file, dir, name, ver, 1);
if (make_directory(dir) == 0) return (NIL);
link_check_flg = 1;
}
unpack_filename(file, dir, name, ver, 1);
if (make_directory(dir) == 0) return (NIL);
if (dskp) link_check_flg = 1;
break;
}
break;
@@ -407,7 +401,7 @@ LispPTR COM_openfile(register LispPTR *args)
if (dskp) {
TIMEOUT(rval = stat(file, &sbuf));
if (rval == 0) {
if ((sbuf.st_mode & S_IFMT) != S_IFREG) {
if (!S_ISREG(sbuf.st_mode)) {
/*
* The Lisp code handles this case as same as "file table
* overflow" error. Final error message is "File won't
@@ -513,7 +507,7 @@ LispPTR COM_openfile(register LispPTR *args)
*bufp = ToLispTime(sbuf.st_mtime);
bufp = (int *)(Addr68k_from_LADDR(args[4]));
if (!dskp && ((sbuf.st_mode & S_IFMT) != S_IFREG) && ((sbuf.st_mode & S_IFMT) != S_IFDIR)) {
if (!dskp && (!S_ISREG(sbuf.st_mode)) && (!S_ISDIR(sbuf.st_mode))) {
/*
* Not a regular file or directory file. Put on a marker.
*/
@@ -617,7 +611,7 @@ LispPTR COM_closefile(register LispPTR *args)
/* Just close. */
TIMEOUT(rval = close(fd));
if (rval == -1) {
if (!dskp && errno == EPERM && (sbuf.st_mode & S_IFREG) == 0) {
if (!dskp && errno == EPERM && !S_ISREG(sbuf.st_mode)) {
/*
* On {UNIX} device, closing a special file we are not
* the owner of it. Although I don't think close fails
@@ -745,7 +739,7 @@ LispPTR COM_closefile(register LispPTR *args)
/* Just close. */
TIMEOUT(rval = close(fd));
if (rval == -1) {
if (!dskp && errno == EPERM && (sbuf.st_mode & S_IFREG) == 0) {
if (!dskp && errno == EPERM && !S_ISREG(sbuf.st_mode)) {
/*
* On {UNIX} device, closing a special file we are not
* the owner of it. Although I don't think close fails
@@ -1945,7 +1939,7 @@ LispPTR COM_readpage(register LispPTR *args)
return (NIL);
}
if ((sbuf.st_mode & S_IFREG) != 0) {
if (S_ISREG(sbuf.st_mode)) {
/*
* The request file is a regular file. We have to make sure that
* next byte read is at the beginning of the requested page of the
@@ -2096,7 +2090,7 @@ LispPTR COM_truncatefile(register LispPTR *args)
return (NIL);
}
if ((sbuf.st_mode & S_IFREG) == 0) {
if (!S_ISREG(sbuf.st_mode)) {
/*
* The request file is not a regular file. We don't need to
* truncate such file.

View File

@@ -127,7 +127,7 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
sock = LispNumToCInt(proto);
result = socket(AF_INET, SOCK_STREAM, 0);
farend.sin_family = AF_INET;
farend.sin_port = sock;
farend.sin_port = htons(sock);
if (connect(result, (struct sockaddr *)&farend, sizeof farend) < 0) {
perror("TCP connect");
return (NIL);

View File

@@ -244,6 +244,7 @@ LispPTR UFS_getfilename(LispPTR *args)
LispPTR UFS_deletefile(LispPTR *args)
{
char file[MAXPATHLEN], fbuf[MAXPATHLEN];
struct stat sbuf;
register int len, rval;
ERRSETJMP(NIL);
@@ -260,11 +261,21 @@ LispPTR UFS_deletefile(LispPTR *args)
#else
if (unixpathname(fbuf, file, 0, 0) == 0) return (NIL);
#endif /* DOS */
/* check if we're operating on directory or file */
TIMEOUT(rval = stat(file, &sbuf));
if (rval == -1) {
*Lisp_errno = errno;
return (NIL);
}
/*
* On UNIX device, all we have to do is just to unlink the file.
* On UNIX device, all we have to do is just to unlink the file
* or directory
*/
TIMEOUT(rval = unlink(file));
if (S_ISDIR(sbuf.st_mode)) {
TIMEOUT(rval = rmdir(file));
} else {
TIMEOUT(rval = unlink(file));
}
if (rval == -1) {
*Lisp_errno = errno;
return (NIL);
@@ -398,7 +409,7 @@ LispPTR UFS_directorynamep(LispPTR *args)
return (NIL);
}
if ((sbuf.st_mode & S_IFMT) != S_IFDIR) return (NIL);
if (!S_ISDIR(sbuf.st_mode)) return (NIL);
/* Convert Unix file naming convention to Xerox Lisp one. */
if (lisppathname(fullname, dirname, 1, 0) == 0) return (NIL);

View File

@@ -129,6 +129,8 @@ static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellar
}
/* Start up shell -- use SHELL environment variable as long as it's in /etc/shells */
shell = getenv("SHELL");
if (shell == NULL) /* shell of last resort */
shell = "/bin/sh";
for (userShell = getusershell(); userShell != NULL && strcmp(shell, userShell) != 0; userShell = getusershell());
if (userShell == NULL) {
perror("$(SHELL) not found in /etc/shells");