Skip to content

[cmds] Add ekermit to distribution images#2557

Merged
ghaerr merged 1 commit intomasterfrom
kermit
Dec 30, 2025
Merged

[cmds] Add ekermit to distribution images#2557
ghaerr merged 1 commit intomasterfrom
kermit

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Dec 30, 2025

Continuation of original contribution in #2554.

Builds ekermit and adds to compressed 1440k and larger images.

The original contribution displayed a large number of compiler warnings. This PR cleans some of the easier messages up, and includes a LOCALFLAGS modification to silence others. In general, it would be nice to fix the remaining issues so that the ELKS build produces less warnings, something we've worked hard on reducing for years.

@tyama501, thank you for the contribution. I'm unable to test, so I didn't try to fix further errors which might affect usability.
The current warning list is:

ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -DNO_LP -DELKS -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pointer-sign -I/Users/greg/net/elks-gh/include -I/Users/greg/net/elks-gh/libc/include -I/Users/greg/net/elks-gh/elks/include -c -o main.o main.c
main.c: In function ‘main’:
main.c:388:14: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     k.dbf    = db ? dodebug : 0; /* for debugging */
              ^
ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -DNO_LP -DELKS -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pointer-sign -I/Users/greg/net/elks-gh/include -I/Users/greg/net/elks-gh/libc/include -I/Users/greg/net/elks-gh/elks/include -c -o kermit.o kermit.c
kermit.c: In function ‘spar’:
kermit.c:1099:26: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             x = xunchar(s[y+1]);
                          ^
kermit.c: In function ‘rpar’:
kermit.c:1168:9: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  k->bct = b;
  ~~~~~~~^~~
kermit.c: In function ‘decode’:
kermit.c:1236:10: warning: ‘p’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       *p = '\0';   /* terminate the string */
       ~~~^~~~~~
kermit.c: In function ‘gattr’:
kermit.c:1340:15: warning: ‘fsizek’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     } else if (fsizek > -1L) {
               ^
kermit.c:1338:8: warning: ‘fsize’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (fsize > -1L) {   /* Remember the file size */
        ^
kermit.c: In function ‘kermit’:
kermit.c:732:14: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           rc = ack(k, k->r_seq, s);
           ~~~^~~~~~~~~~~~~~~~~~~~~
ia16-elf-gcc -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf -Wextra -Wtype-limits -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-implicit-int -Wno-parentheses -DNO_LP -DELKS -Wno-unused-variable -Wno-unused-but-set-variable -Wno-pointer-sign -I/Users/greg/net/elks-gh/include -I/Users/greg/net/elks-gh/libc/include -I/Users/greg/net/elks-gh/elks/include -c -o elksio.o elksio.c
elksio.c: In function ‘fileinfo’:
elksio.c:513:19: warning: comparison is always true due to limited range of data type [-Wtype-limits]
      while (count < SCANSIZ && !isbinary) { /* Scan this much */
                   ^
In file included from elksio.c:59:0:
elksio.c: In function ‘readfile’:
debug.h:34:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define debug(a,b,c,d) dodebug(a,(UCHAR *)b,(UCHAR *)c,(long)(d))
                                                        ^
elksio.c:581:5: note: in expansion of macro ‘debug’
     debug(DB_LOG,"readfile exit zinptr",0,k->zinptr);
     ^~~~~
ia16-elf-gcc -o ekermit -mcmodel=small -melks-libc -mtune=i8086 -Wall -Os -mno-segment-relocation-stuff -fno-inline -fno-builtin-printf -fno-builtin-fprintf main.o kermit.o elksio.o 

In some cases, the "maybe uninitialized" warnings can be removed by setting the variable to 0 on declaration, but one must be somewhat careful, as this could also be a warning of bad programming. I realize that e-kermit is ancient and it may be lots of work to fix all these. If so, that's ok, but thought to mention it.

@ghaerr ghaerr merged commit 011e0da into master Dec 30, 2025
1 check passed
@ghaerr ghaerr deleted the kermit branch December 30, 2025 16:47
@tyama501
Copy link
Copy Markdown
Contributor

Hello @ghaerr ,

Thank you!

I wrote #2495 (comment) now.

I'm thinking to try compiling and add the host version when I have another time.
(unixio is just a sample, so I'm thinking to use elksio but compile it with host gcc)

@tyama501
Copy link
Copy Markdown
Contributor

Hello @ghaerr

I see undef X_OK has been moved to kermit.h and it is removed from unixio.c.
It seems that the undef X_OK still remains in elksio.c but is there any reason for this?
If no, I will remove this on the next commit.

Thank you.

@ghaerr
Copy link
Copy Markdown
Owner Author

ghaerr commented Dec 31, 2025

No, I didn't notice that in elksio.c, feel free to remove it and/or change things. The important item I noticed was that X_OK is defined to be 1 in unistd.h, but 0 in kermit.h, so one has to be careful when using the access system call, where X_OK means check execute permission.

I only notice one call to access which is in main.c, and that passes the constant 4 which is a bad idea. I presume, but have not tested, that R_OK is what's needed. These are the sorts of pitfalls one can encounter when porting ancient code.

Feel free to remove X_OK in elksio.c or anything else you need to do to get ekermit to work better. I only made these quick changes because I noticed them while taking a quick look at the source code, but no testing.

@tyama501
Copy link
Copy Markdown
Contributor

Hello @ghaerr ,

Thank you!
Yes, I noticed the X_OK is redefined before but I didn't find the best way.
I will remove it in elksio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants