troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
621 stars 61 forks source link

fsck output string truncation too short #260

Closed hongkongkiwi closed 2 years ago

hongkongkiwi commented 2 years ago

I noticed that my startup logs look like this:

[ OK ] Checking filesystem /dev/mmcblk0p
[ OK ] Checking filesystem /dev/mmcblk0p
[ OK ] Checking filesystem /dev/mmcblk0p
[ OK ] Checking filesystem /dev/mmcblk0p
[ OK ] Checking filesystem /dev/mmcblk0p

After investigation I found that there is a hardcoded size for an output string here: https://github.com/troglobit/finit/blob/181d9556a1364ad2977b9cbd75a4b59a4ba79d89/src/finit.c#L259

So this assumes that the string is not more than 13 chars, however I think this is not necessarily true. e.g.

So my suggestion is to set this to by default 18 chars as that should cover a majority of cases.

Additionally, if it's larger than 18 chars, for example if you had a weird case of "/dev/mmcblk0boot10" perhaps you could append ... e.g. [ OK ] Checking filesystem /dev/mmcblk0boot1... so people know it's been truncated.

Or perhaps no need to set any limit on the size?

troglobit commented 2 years ago

Yes, thanks for pointing this out!