SCP: sprint_val comma bug, GH: Remnant symlinks
- Fix comma separator code segmentation fault: "ndigit - 3" can become a very large unsigned number for ndigit < 3. - dir_cmd: Allocate WildName from heap to reduce stack pressure. - Github CI/CD: Remnant symlink issue reappeared, afflicting the makefile-based build. For better or worse, the workaround is now dependent on specific Python versions that must be removed, unlinked and any remnant symlinks that HomeBrew decided it needed to install in /usr/local/bin. The Python upgrade is triggered by the sdl2_ttf package. According to the Github image maintainers, this is an old, known issue in macOS images that originates inside of Homebrew.
This commit is contained in:
parent
c47e933a60
commit
ae9e57f659
4 changed files with 42 additions and 18 deletions
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
|
@ -35,10 +35,26 @@ jobs:
|
||||||
- scelbi 3b2 i701 i704 i7010 i7070 i7080 i7090 sigma uc15 i650 sel32 intel-mds ibm1130
|
- scelbi 3b2 i701 i704 i7010 i7070 i7080 i7090 sigma uc15 i650 sel32 intel-mds ibm1130
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install dependencies
|
## Workaround for remnant symlinks in /usr/local pointing back to
|
||||||
|
## macOS frameworks.
|
||||||
|
##
|
||||||
|
## Future: Will have to keep an eye on SDL_ttf's Python dependency
|
||||||
|
## so that the correct/appropriate Python version is removed.
|
||||||
|
- name: Remnant symlink cleanup (macOS)
|
||||||
|
if: ${{runner.os == 'macOS'}}
|
||||||
|
run: |
|
||||||
|
brew unlink python@3 || true
|
||||||
|
brew uninstall --ignore-dependencies python@3 || true
|
||||||
|
brew unlink python@3.12 || true
|
||||||
|
brew uninstall --ignore-dependencies python@3.12 || true
|
||||||
|
for f in $(find /usr/local/bin -type l -print); do \
|
||||||
|
(readlink $f | grep -q -s "/Library") && echo Removing "$f" && rm -f "$f"; \
|
||||||
|
done || exit 0
|
||||||
|
## Install our regular dependencies.
|
||||||
|
- name: Install dependencies (macOS)
|
||||||
if: ${{runner.os == 'macOS'}}
|
if: ${{runner.os == 'macOS'}}
|
||||||
run: sh -ex .travis/deps.sh osx
|
run: sh -ex .travis/deps.sh osx
|
||||||
- name: Install dependencies
|
- name: Install dependencies (Linux)
|
||||||
if: ${{runner.os == 'Linux'}}
|
if: ${{runner.os == 'Linux'}}
|
||||||
run: sh -ex .travis/deps.sh linux
|
run: sh -ex .travis/deps.sh linux
|
||||||
- name: makefile build
|
- name: makefile build
|
||||||
|
|
15
.github/workflows/cmake-builds.yml
vendored
15
.github/workflows/cmake-builds.yml
vendored
|
@ -46,15 +46,22 @@ jobs:
|
||||||
os: [macos-12, macos-11]
|
os: [macos-12, macos-11]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
## For some reason, the macos-11 image has symlinks to /Library in /usr/local/bin
|
## Workaround for remnant symlinks in /usr/local pointing back to
|
||||||
- name: Clean /usr/local/bin symlinks
|
## macOS frameworks.
|
||||||
|
##
|
||||||
|
## Future: Will have to keep an eye on SDL_ttf's Python dependency
|
||||||
|
## so that the correct/appropriate Python version is removed.
|
||||||
|
- name: Remnant symlink cleanup
|
||||||
run: |
|
run: |
|
||||||
|
brew unlink python@3 || true
|
||||||
|
brew uninstall --ignore-dependencies python@3 || true
|
||||||
|
brew unlink python@3.12 || true
|
||||||
|
brew uninstall --ignore-dependencies python@3.12 || true
|
||||||
for f in $(find /usr/local/bin -type l -print); do \
|
for f in $(find /usr/local/bin -type l -print); do \
|
||||||
(readlink $f | grep -q -s "/Library") && echo Removing "$f" && rm -f "$f"; \
|
(readlink $f | grep -q -s "/Library") && echo Removing "$f" && rm -f "$f"; \
|
||||||
done || exit 0
|
done || exit 0
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: sh -ex .travis/deps.sh osx
|
||||||
sh -ex .travis/deps.sh osx
|
|
||||||
- name: cmake-builder.sh
|
- name: cmake-builder.sh
|
||||||
run: |
|
run: |
|
||||||
cmake/cmake-builder.sh --config Release --flavor xcode --lto --notest --cpack_suffix x86_64.${{matrix.os}}
|
cmake/cmake-builder.sh --config Release --flavor xcode --lto --notest --cpack_suffix x86_64.${{matrix.os}}
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
install_osx() {
|
install_osx() {
|
||||||
brew update
|
brew update
|
||||||
brew install pkg-config
|
brew install pkg-config pcre libpng libedit sdl2 freetype2 sdl2_ttf \
|
||||||
brew install pcre libpng libedit
|
vde cmake gnu-getopt coreutils
|
||||||
brew install sdl2 freetype2 sdl2_ttf
|
|
||||||
brew install vde
|
|
||||||
brew install cmake gnu-getopt coreutils
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_linux() {
|
install_linux() {
|
||||||
|
|
14
scp.c
14
scp.c
|
@ -260,7 +260,7 @@
|
||||||
#define MIN(a,b) (((a) <= (b)) ? (a) : (b))
|
#define MIN(a,b) (((a) <= (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
/* Max width of a value expressed as a formatted string */
|
/* Max width of a value expressed as a formatted string */
|
||||||
#define MAX_WIDTH ((int) ((CHAR_BIT * sizeof (t_value) * 4 + 3)/3))
|
#define MAX_WIDTH ((CHAR_BIT * sizeof (t_value) * 4 + 3) / 3)
|
||||||
|
|
||||||
|
|
||||||
/* search logical and boolean ops */
|
/* search logical and boolean ops */
|
||||||
|
@ -7406,9 +7406,12 @@ t_stat dir_cmd (int32 flg, CONST char *cptr)
|
||||||
{
|
{
|
||||||
DIR_CTX dir_state;
|
DIR_CTX dir_state;
|
||||||
t_stat r;
|
t_stat r;
|
||||||
char WildName[PATH_MAX + 1];
|
char *WildName;
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
|
|
||||||
|
if ((WildName = (char *) calloc(PATH_MAX + 1, sizeof(char))) == NULL)
|
||||||
|
return SCPE_MEM;
|
||||||
|
|
||||||
GET_SWITCHES (cptr); /* get switches */
|
GET_SWITCHES (cptr); /* get switches */
|
||||||
memset (&dir_state, 0, sizeof (dir_state));
|
memset (&dir_state, 0, sizeof (dir_state));
|
||||||
strlcpy (WildName, cptr, sizeof(WildName));
|
strlcpy (WildName, cptr, sizeof(WildName));
|
||||||
|
@ -7431,8 +7434,9 @@ if (r != SCPE_OK) {
|
||||||
sim_printf ("\n Directory of %s\n\n", cp);
|
sim_printf ("\n Directory of %s\n\n", cp);
|
||||||
sim_printf ("File Not Found\n\n");
|
sim_printf ("File Not Found\n\n");
|
||||||
free (cp);
|
free (cp);
|
||||||
return SCPE_OK;
|
r = SCPE_OK;
|
||||||
}
|
}
|
||||||
|
free(WildName);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11688,7 +11692,7 @@ dbuf[MAX_WIDTH] = 0;
|
||||||
d = MAX_WIDTH;
|
d = MAX_WIDTH;
|
||||||
do {
|
do {
|
||||||
d = d - 1;
|
d = d - 1;
|
||||||
digit = (int32) (val % radix);
|
digit = val % radix;
|
||||||
val = val / radix;
|
val = val / radix;
|
||||||
dbuf[d] = (char)((digit <= 9)? '0' + digit: 'A' + (digit - 10));
|
dbuf[d] = (char)((digit <= 9)? '0' + digit: 'A' + (digit - 10));
|
||||||
} while ((d > 0) && (val != 0));
|
} while ((d > 0) && (val != 0));
|
||||||
|
@ -11706,7 +11710,7 @@ switch (format) {
|
||||||
break;
|
break;
|
||||||
ndigits = MAX_WIDTH - digit;
|
ndigits = MAX_WIDTH - digit;
|
||||||
commas = (ndigits - 1)/3;
|
commas = (ndigits - 1)/3;
|
||||||
for (digit=0; digit<ndigits-3; digit++)
|
for (digit=0; digit + 3 < ndigits; digit++)
|
||||||
dbuf[MAX_WIDTH + (digit - ndigits) - (ndigits - digit - 1)/3] = dbuf[MAX_WIDTH + (digit - ndigits)];
|
dbuf[MAX_WIDTH + (digit - ndigits) - (ndigits - digit - 1)/3] = dbuf[MAX_WIDTH + (digit - ndigits)];
|
||||||
for (digit=1; digit<=commas; digit++)
|
for (digit=1; digit<=commas; digit++)
|
||||||
dbuf[MAX_WIDTH - (digit * 4)] = ',';
|
dbuf[MAX_WIDTH - (digit * 4)] = ',';
|
||||||
|
|
Loading…
Add table
Reference in a new issue