From b3e99083c23802f9afebb727678ab30cfeb02441 Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 22 Nov 2026 13:57:22 +0000 Subject: [PATCH 1/4] CI: Update share build 1/ Update submodule from master repo 2/ Copy not move binary to target directory --- ci_build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index 284bbd4f..572c6d10 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -20,13 +20,13 @@ mv -n bin/kgc*.map bin/kgc*.sys _output/gcc/. mv -n bin/country.sys _output/gcc/. # GCC share ( + git submodule update --remote share cd share - git submodule update --init --recursive git clean -x -d -f env COMPILER=gcc ./build.sh ) -mv -n share/src/share.com _output/gcc/. -mv -n share/src/share.map _output/gcc/. +cp -p share/src/share.com _output/gcc/. +cp -p share/src/share.map _output/gcc/. # Open Watcom Environment Setup export WATCOM=$BUILD_DIR/_watcom @@ -95,13 +95,13 @@ if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then mv -n bin/country.sys _output/tc_dos/. # TC share ( + git submodule update --remote share cd share - git submodule update --init --recursive git clean -x -d -f env COMPILER=tcc2-emu ./build.sh ) - mv -n share/src/share.com _output/tc_dos/. - mv -n share/src/share.map _output/tc_dos/. + cp -p share/src/share.com _output/tc_dos/. + cp -p share/src/share.map _output/tc_dos/. fi echo done From 1955f0e6e261a224ba35047caa2d000bb9f5c66f Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 22 Nov 2026 10:20:43 +0000 Subject: [PATCH 2/4] share: Preserve SI register on share_is_file_open --- kernel/int2f.asm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/int2f.asm b/kernel/int2f.asm index 3e9462b8..c5cdd108 100644 --- a/kernel/int2f.asm +++ b/kernel/int2f.asm @@ -357,17 +357,18 @@ SHARE_LOCK_UNLOCK: ; STATIC WORD share_is_file_open(const char far *filename) /* pointer to fully qualified filename */ global SHARE_IS_FILE_OPEN SHARE_IS_FILE_OPEN: - mov si, ds - mov es, si ; save ds - pop ax ; save return address - pop si ; filename - pop ds ; SEG filename - push ax ; restore return address + push bp + mov bp, sp + arg {filename,4} + push si + push ds + lds si, [.filename] mov ax, 0x10a6 int 0x2f ; returns ax - mov si, es ; restore ds - mov ds, si - ret + pop ds + pop si + pop bp + ret 4 ; Int 2F Multipurpose Remote System Calls ; From 5e56ea6c142644e9788f92dbe01afef88259090d Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sun, 22 Nov 2026 11:24:50 +0000 Subject: [PATCH 3/4] share: Check if call to reached a modern share On older releases of share there was no 10a6 function, so after an unhandled call to it the return value could be rubbish. Set the carry flag beforehand and check that the flag is clear before testing the value. If it is set then we follow the old behaviour of allowing delete / rename on all files including open ones, otherwise we'd find the situation described in https://github.com/FDOS/kernel/issues/276. --- kernel/int2f.asm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/int2f.asm b/kernel/int2f.asm index c5cdd108..69e3d5b2 100644 --- a/kernel/int2f.asm +++ b/kernel/int2f.asm @@ -364,7 +364,14 @@ SHARE_IS_FILE_OPEN: push ds lds si, [.filename] mov ax, 0x10a6 + stc int 0x2f ; returns ax + jc .notopen ; error or missing + cmp ax, 1 ; only an explicit 1 means "open" + je .done +.notopen: + xor ax, ax +.done: pop ds pop si pop bp From 2eda276bc19dd4708d2fdbccb1b6e1cd440a14fe Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Sat, 28 Nov 2026 17:00:02 +0000 Subject: [PATCH 4/4] share: SHARE_COMPAT Rename, Delete, and SetFattr fixes Rename / Delete / SetFattr of a file that's already been opened with SHARE_COMPAT should succeed and otherwise return an error. As this changes the interface of int2f/10a6 it should be applied at the same time as the corresponding patch in share. Modelled on a similar fix to FDPP which was applied in the following patches: f15bd2f33a49e50db7a05da7d9751dec1aa6f834 d530b5a65a873a2438b0ff9fd37a406d5fc63f7f --- kernel/dosfns.c | 18 +++++++++++++++--- kernel/int2f.asm | 27 ++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 312cbfa1..7b09fbbb 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -87,7 +87,7 @@ extern int ASMPASCAL 1 if open 0 if not */ extern int ASMPASCAL - share_is_file_open(const char far * filename); + share_is_file_open(const char far * filename, unsigned short *mode, unsigned short *pspseg); /* /// End of additions for SHARE. - Ron Cemer */ @@ -1235,6 +1235,13 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD attrp) DebugPrintf(("DosSetFattr(%s)\n", name)); if (IsShareInstalled(TRUE)) { + UWORD mode, psp; + + /* SHARE refuses to change attrs if file is opened */ + if (share_is_file_open(PriPathName, &mode, &psp) && + (((mode >> 8) != 0 /* SHARE_COMPAT */) || psp != cu_psp)) + return DE_ACCESS; + /* SHARE closes the file if it is opened in * compatibility mode, else generate a critical error. * Here generate a critical error by opening in "rw compat" mode */ @@ -1259,6 +1266,7 @@ UBYTE DosSelectDrv(UBYTE drv) COUNT DosDelete(BYTE FAR * path, int attrib) { COUNT result; + UWORD mode, psp; result = truename(path, PriPathName, CDS_MODE_CHECK_DEV_PATH); if (result < SUCCESS) @@ -1272,7 +1280,8 @@ COUNT DosDelete(BYTE FAR * path, int attrib) if (result & IS_DEVICE) return DE_FILENOTFND; - if (IsShareInstalled(TRUE) && share_is_file_open(PriPathName)) + if (IsShareInstalled(TRUE) && share_is_file_open(PriPathName, &mode, &psp) && + (((mode >> 8) != 0 /* SHARE_COMPAT */) || psp != cu_psp)) return DE_ACCESS; return dos_delete(PriPathName, attrib); @@ -1280,6 +1289,8 @@ COUNT DosDelete(BYTE FAR * path, int attrib) COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib) { + UWORD mode, psp; + if (path1[0] != path2[0]) { return DE_DEVICE; /* not same device */ @@ -1287,7 +1298,8 @@ COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib) if (FP_OFF(current_ldt) == 0xFFFF || (current_ldt->cdsFlags & CDSNETWDRV)) return network_redirector(REM_RENAME); - if (IsShareInstalled(TRUE) && share_is_file_open(path1)) + if (IsShareInstalled(TRUE) && share_is_file_open(path1, &mode, &psp) && + (((mode >> 8) != 0 /* SHARE_COMPAT */) || psp != cu_psp)) return DE_ACCESS; return dos_rename(path1, path2, attrib); diff --git a/kernel/int2f.asm b/kernel/int2f.asm index 69e3d5b2..fee68568 100644 --- a/kernel/int2f.asm +++ b/kernel/int2f.asm @@ -354,28 +354,45 @@ SHARE_LOCK_UNLOCK: ; Returns: ; 1 if open ; 0 if not -; STATIC WORD share_is_file_open(const char far *filename) /* pointer to fully qualified filename */ +; STATIC WORD share_is_file_open(const char far *filename, UWORD *mode, UWORD *pspseg) global SHARE_IS_FILE_OPEN SHARE_IS_FILE_OPEN: push bp mov bp, sp - arg {filename,4} + arg {filename,4}, mode, pspseg push si push ds lds si, [.filename] + xor cx, cx + xor dx, dx mov ax, 0x10a6 stc int 0x2f ; returns ax jc .notopen ; error or missing cmp ax, 1 ; only an explicit 1 means "open" - je .done + je .setparams .notopen: xor ax, ax + xor cx, cx + xor dx, dx + +.setparams: + pop ds ; caller's DS again, for the pointers + +.setmode + mov si, [.mode] + test si, si ; NULL = caller doesn't want the mode + jz .setpsp + mov [si], cx ; (sharemode << 8) | openmode +.setpsp: + mov si, [.pspseg] + test si, si ; NULL = caller doesn't want the pspseg + jz .done + mov [si], dx ; PSP of the open file .done: - pop ds pop si pop bp - ret 4 + ret 8 ; Int 2F Multipurpose Remote System Calls ;