libc issueshttps://lab.knightsofnii.com/fixos-core-team/libc/-/issues2018-04-30T11:57:42Zhttps://lab.knightsofnii.com/fixos-core-team/libc/-/issues/4cat-like program yields a kernel panic2018-04-30T11:57:42ZEiyeron Fulmincendiicat-like program yields a kernel panicA simple program like a cat will trigger an oops. As I'm not able to get informations with the USB, I'm porividing the culprit to you.
```c
#include "cat.h"
#include "builtins.h"
#include <stdio.h>
static void usage(char *exec...A simple program like a cat will trigger an oops. As I'm not able to get informations with the USB, I'm porividing the culprit to you.
```c
#include "cat.h"
#include "builtins.h"
#include <stdio.h>
static void usage(char *execname)
{
printf("usage : %s file\n", execname);
}
int builtin_cat(char **args)
{
if (args[1] == NULL || args[2] != NULL) {
usage(args[0]);
return -1;
}
FILE* file = NULL
file = fopen(args[1], "r");
if(file == NULL) {
perror("cat");
return -1;
}
int c = 0;
while(!feof(file) && !ferror(file) && ++c < 100)
putchar(fgetc(file));
if(ferror(file)) {
perror("ls");
fclose(file);
return -1;
}
fclose(file);
return 0;
}
```https://lab.knightsofnii.com/fixos-core-team/libc/-/issues/3Program setjmp and longjmp2018-04-30T11:57:42ZEiyeron FulmincendiiProgram setjmp and longjmpTo support C++ exceptions or arbitrary jumps, `setjmp` and `longjmp` should be added to the lib. They are the basis of some pseudo-multithreads systems like coroutines.To support C++ exceptions or arbitrary jumps, `setjmp` and `longjmp` should be added to the lib. They are the basis of some pseudo-multithreads systems like coroutines.Eiyeron FulmincendiiEiyeron Fulmincendiihttps://lab.knightsofnii.com/fixos-core-team/libc/-/issues/2Several problems with scanf-family functions2018-04-30T11:57:42ZLéo GrangeSeveral problems with scanf-family functionsThe `scanf()`, `fscanf()` and other file-based formatted options seem broken in current libc.
These functions are part of PDCLib code base, but were probably under-tested by its author, because even simple cases like `scanf("%s", buf)` ...The `scanf()`, `fscanf()` and other file-based formatted options seem broken in current libc.
These functions are part of PDCLib code base, but were probably under-tested by its author, because even simple cases like `scanf("%s", buf)` fail to produce expected result.
We need, in a first time, to fix at least two things :
- modifier "%s" work once, but is unable to deal with blankspace **!?**
- many integer modifiers, like "%d", work well but do not trigger `ferror()` in case of mismatch
In a second time, all the stdio implementation need a deeper review and test to be sure we don't carry too much bad implementation with our libc, and maybe check existing implementation in other libc (especially BSD ones) to change entirely the design used (to have something far more tested).Léo GrangeLéo Grange