Currently when given a path to a file, ls will open the file to determine
if its is valid and then run the appropriate print function, in contrast to
directory arguments that use the directory iterator and callback on each
file. One issue with this is that opening a file does not allow access to
its modification time information, whereas the info object from the callback
called by the directory iterator does and the longlist print function will
print the modification time if present. The result is that when longlisting
ls arguments, directory arguments show moditication times but file arguments
do not. Patch 2 rectifies this an in the process simplifies the code path
by using the directory iterator for file arguments as well.
The implementation of patch 2 exposed a bug in grub_disk_read() which is
fixed in patch 1.
Patches 3 and 4 aim to make the output of GRUB's ls look more like GNU's
ls output. And patch 4 also fixes an issue where there are blank lines
between consecutive file arguments.
Glenn
Glenn Washburn (4):
disk: Reset grub_errno upon entering grub_disk_read()
Where does the error come from? We generally prefer to have grub_print_error() (better) or resetting grib_errno after the error is produced rather than blanketly reset grub_errno at the beginning
commands/ls: Allow printing mtime for file arguments
commands/ls: Add directory header for dir args and print full paths
for file args
commands/ls: Proper line breaks between arguments
grub-core/commands/ls.c | 117 +++++++++++++++++++++++-----------------
grub-core/kern/disk.c | 2 +
2 files changed, 71 insertions(+), 48 deletions(-)
--
2.34.1
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel