Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ This documents significant changes in the dev branch of ksh 93u+m.
For full details, see the git log at: https://github.com/ksh93/ksh
Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library.

2026-04-14:

- Ksh is now capable of allocating memory within a 64-bit address space.

2026-04-13:

- Fixed a potential crash that could occur if a shell discipline function
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/ksh93/builtins.mm
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ int optget(char *\fIargv\fP[], const char *\fIoptstring\fP)
.EX
\fIyourfunction\fP()
{
char *savebase;
int saveoffset;
char *savebase;
ptrdiff_t saveoffset;
if(saveoffset=stktell(stkstd))
savebase = stkfreeze(stkstd,0);
\fR...\fP
Expand Down
11 changes: 6 additions & 5 deletions src/cmd/ksh93/features/externs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ tst note{ determining default number of extra bytes per argument for arguments l

int main(int argc,char *argv[])
{
int extra_bytes = 0, envlen, argmax, i;
size_t extra_bytes = 0, envlen;
int argmax, i;
pid_t childpid;
Sfio_t *notebuf;
char *note;
Expand All @@ -69,7 +70,7 @@ tst note{ determining default number of extra bytes per argument for arguments l
for(i=0; environ[i]; i++)
envlen += strlen(environ[i]) + 1 + extra_bytes;
envlen += 1 + extra_bytes; /* final null element */
argmax = (int)astconf_long(CONF_ARG_MAX) - envlen;
argmax = (int)astconf_long(CONF_ARG_MAX) - (int)envlen;
if (argmax < 2048)
{
error(ERROR_ERROR|2, "argmax too small");
Expand All @@ -82,7 +83,7 @@ tst note{ determining default number of extra bytes per argument for arguments l
int bytec;

error_info.id="_arg_extrabytes test (child)";
argv = stkalloc(stkstd, (argmax / 2 + 1) * sizeof(char*));
argv = stkalloc(stkstd, (size_t)(argmax / 2 + 1) * sizeof(char*));
argc = bytec = 0;
while(bytec < argmax)
{
Expand Down Expand Up @@ -137,13 +138,13 @@ tst note{ determining default number of extra bytes per argument for arguments l
}
/* show note in iffe output via inherited FD 9 */
notebuf = sfstropen();
sfprintf(notebuf," %d ...",extra_bytes);
sfprintf(notebuf," %zu ...",extra_bytes);
note = sfstruse(notebuf);
write(9,note,strlen(note));
sfclose(notebuf);
/* add #define to header via stdout */
sfprintf(sfstdout,
"#define _arg_extrabytes\t%d\t/* extra bytes per argument for arguments list */\n",
"#define _arg_extrabytes\t%zu\t/* extra bytes per argument for arguments list */\n",
extra_bytes);
return 0;
}
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/ksh93/features/fchdir
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ tst openat_enotdir note{ does openat set ENOTDIR when it fails because the file
int main(void)
{
char filename[64];
int n, saverrno;
pid_t child;
sprintf(filename,".file.%u",(unsigned int)getpid());
int saverrno;
sprintf(filename,".file.%ju",(uintmax_t)getpid());
open(filename,O_RDWR|O_CREAT); /* let the OS close the fd after completion */
openat(AT_FDCWD, filename, O_DIRECTORY|O_NONBLOCK|O_cloexec|O_SEARCH);
saverrno = errno;
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/features/poll
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tst pipe_socketpair note{ use socketpair() for peekable pipe() }end execute{
#endif
static void handler(int sig)
{
NOT_USED(sig);
_exit(0);
}
int main(void)
Expand Down Expand Up @@ -72,7 +73,6 @@ tst socketpair_devfd note{ /dev/fd/N handles socketpair() }end execute{
#include <sys/socket.h>
int main(void)
{
int devfd;
int n;
int sfd[2];
ast_close(0);
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/argnod.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct ionod
struct ionod *iolst;
char *iodelim;
off_t iooffset;
long iosize;
Sfoff_t iosize;
char *iovname;
};

Expand Down
16 changes: 8 additions & 8 deletions src/cmd/ksh93/include/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
/* used for output of shell errors */
#define ERRIO 2

#define IOREAD 001
#define IOWRITE 002
#define IODUP 004
#define IOSEEK 010
#define IONOSEEK 020
#define IOTTY 040
#define IOCLEX 0100
#define IOREAD 001U
#define IOWRITE 002U
#define IODUP 004U
#define IOSEEK 010U
#define IONOSEEK 020U
#define IOTTY 040U
#define IOCLEX 0100U
#define IOCLOSE (IOSEEK|IONOSEEK)

#define IOSUBSHELL 0x8000 /* must be larger than any file descriptor */
Expand Down Expand Up @@ -74,7 +74,7 @@
#define sh_editor_active() 0
#endif

extern int sh_iocheckfd(int);
extern uint8_t sh_iocheckfd(int);
extern void sh_ioinit(void);
extern int sh_iomovefd(int,int);
extern int sh_iorenumber(int,int);
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/ksh93/include/jobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct jobs
{
struct process *pwlist; /* head of process list */
int *exitval; /* pipe exit values */
unsigned char *freejobs; /* free jobs numbers */
pid_t curpgid; /* current process GID */
pid_t parent; /* set by fork() */
pid_t mypid; /* process ID of shell */
Expand All @@ -75,13 +76,12 @@ struct jobs
#if SHOPT_BGX
int numbjob; /* number of background jobs */
#endif /* SHOPT_BGX */
short fd; /* tty descriptor number */
int suspend; /* suspend character */
int fd; /* tty descriptor number */
cc_t suspend; /* suspend character */
char jobcontrol; /* turned on for interactive shell with control of terminal */
char waitsafe; /* wait will not block */
char waitall; /* wait for all jobs in pipe */
char toclear; /* job table needs clearing */
unsigned char *freejobs; /* free jobs numbers */
};

/* flags for joblist */
Expand Down
24 changes: 12 additions & 12 deletions src/cmd/ksh93/include/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
# endif
#endif /* !SHOPT_SPAWN */

#define PATH_PATH 0001
#define PATH_FPATH 0002
#define PATH_CDPATH 0004
#define PATH_BFPATH 0010
#define PATH_SKIP 0020
#define PATH_STD_DIR 0100 /* directory is on $(getconf PATH) */
#define PATH_PATH 0001U
#define PATH_FPATH 0002U
#define PATH_CDPATH 0004U
#define PATH_BFPATH 0010U
#define PATH_SKIP 0020U
#define PATH_STD_DIR 0100U /* directory is on $(getconf PATH) */

#define PATH_OFFSET 2 /* path offset for path_join */
#define MAXDEPTH 1024 /* maximum shell function recursion depth */
Expand All @@ -57,8 +57,8 @@ typedef struct pathcomp
char *lib;
char *bbuf;
char *blib;
unsigned short len;
unsigned short flags;
size_t len;
uint16_t flags;
} Pathcomp_t;

#ifndef _ARGNOD_H
Expand All @@ -69,15 +69,15 @@ typedef struct pathcomp
extern void path_newdir(Pathcomp_t*);
extern Pathcomp_t *path_dirfind(Pathcomp_t*,const char*,int);
extern Pathcomp_t *path_unsetfpath(void);
extern Pathcomp_t *path_addpath(Pathcomp_t*,const char*,int);
extern Pathcomp_t *path_addpath(Pathcomp_t*,const char*,uint16_t);
extern Pathcomp_t *path_dup(Pathcomp_t*);
extern void path_delete(Pathcomp_t*);
extern void path_settrackedalias(const char*,Pathcomp_t*);
extern Namval_t *path_gettrackedalias(const char*);
extern Pathcomp_t *path_absolute(const char*, Pathcomp_t*, int);
extern char *path_basename(const char*);
extern char *path_fullname(const char*);
extern int path_expand(const char*, struct argnod**, int);
extern size_t path_expand(const char*, struct argnod**, int);
extern noreturn void path_exec(const char*,char*[],struct argnod*);
extern pid_t path_spawn(const char*,char*[],char*[],Pathcomp_t*,int);
extern int path_open(const char*,Pathcomp_t*);
Expand All @@ -86,9 +86,9 @@ extern char *path_pwd(void);
extern Pathcomp_t *path_nextcomp(Pathcomp_t*,const char*,Pathcomp_t*);
extern int path_search(const char*,Pathcomp_t**,int);
extern char *path_relative(const char*);
extern int path_complete(const char*, const char*,struct argnod**);
extern size_t path_complete(const char*, const char*,struct argnod**);
#if SHOPT_BRACEPAT
extern int path_generate(struct argnod*,struct argnod**, int);
extern ssize_t path_generate(struct argnod*,struct argnod**, int);
#endif /* SHOPT_BRACEPAT */

#if SHOPT_DYNAMIC
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ struct Shell_s
Shbltin_t bltindata;
ptrdiff_t offsets[10];
Sfio_t **sftable;
unsigned char *fdstatus;
uint8_t *fdstatus;
char *pwd;
#if _lib_openat
int pwdfd; /* file descriptor for pwd */
Expand Down
14 changes: 7 additions & 7 deletions src/cmd/ksh93/include/streval.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ struct lval
Sfdouble_t (*fun)(Sfdouble_t,...);
const char *expr;
const void *enum_p; /* pointer to the lvalue's enum type */
int nosub;
char *sub;
size_t elen;
int nosub;
int emode;
short flag;
short nargs;
short emode;
short level;
short elen;
char isenum; /* set if the lvalue is of an enum type */
char isfloat;
};
Expand All @@ -95,10 +95,10 @@ typedef struct _arith_
unsigned char *code;
const char *expr;
Sfdouble_t (*fun)(const char**,struct lval*,int,Sfdouble_t);
short size;
short staksize;
short emode;
short elen;
size_t elen;
ptrdiff_t size;
ptrdiff_t staksize;
int emode;
} Arith_t;
#define ARITH_COMP 04 /* set when compile separate from execute */
#define ARITH_ASSIGNOP 010 /* set during assignment operators */
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <ast_release.h>
#include "git.h"

#define SH_RELEASE_DATE "2026-04-13" /* must be in this format for $((.sh.version)) */
#define SH_RELEASE_DATE "2026-04-14" /* must be in this format for $((.sh.version)) */
/*
* This comment keeps SH_RELEASE_DATE a few lines away from SH_RELEASE_SVER to avoid
* merge conflicts when cherry-picking dev branch commits onto a release branch.
Expand Down
Loading