From 028d547d732104de046ca7d1b9519a950177b176 Mon Sep 17 00:00:00 2001 From: Thomas Hebb Date: Wed, 24 Sep 2025 11:22:40 -0400 Subject: [PATCH 1/3] efs_shell: Fix argument order of ln The ln command in EFS Shell operates the same as ln on Linux: it takes the existing file first and the new link second. But the argument names were swapped, making the argparse help text confusing. --- src/modules/efs_shell_commands/ln.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/efs_shell_commands/ln.py b/src/modules/efs_shell_commands/ln.py index 5799331..9c7bda8 100644 --- a/src/modules/efs_shell_commands/ln.py +++ b/src/modules/efs_shell_commands/ln.py @@ -21,8 +21,8 @@ def get_argument_parser(self, subparsers_object : _SubParsersAction) -> Argument argument_parser = subparsers_object.add_parser('ln', description = "Create an UNIX symbolic link across the remote EFS.") - argument_parser.add_argument('remote_newlink') argument_parser.add_argument('remote_target') + argument_parser.add_argument('remote_newlink') return argument_parser @@ -33,8 +33,8 @@ def execute_command(self, diag_input, args : Namespace): opcode, payload = diag_input.send_recv(DIAG_SUBSYS_CMD_F, pack(' Date: Wed, 24 Sep 2025 11:25:32 -0400 Subject: [PATCH 2/3] efs_shell: Allow ls when stat data is empty When we have list permission for a directory but not read permission for a file within that directory, all metadata for that file except its name is zeroed out. Currently, this causes a crash looking up the "File type" string. Add a new entry to gracefully handle this case. Unknown files now look like this: +---------------------------------------------------------------------------------------------------------------------------+ + File type | Special flags | File rights | File name | File size | Modification | Creation + +---------------------------------------------------------------------------------------------------------------------------+ + Unknown | | --------- | 'mcfg' | 0 | 1969-12-31 19:00:00 | 1969-12-31 19:00:00 + +---------------------------------------------------------------------------------------------------------------------------+ --- src/protocol/efs2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/protocol/efs2.py b/src/protocol/efs2.py index 06cb2ab..2d75dbd 100644 --- a/src/protocol/efs2.py +++ b/src/protocol/efs2.py @@ -17,6 +17,7 @@ } EFS2_FILE_TYPES = { + 0o000000: 'Unknown', 0o010000: 'FIFO (S_IFIFO)', 0o020000: 'Character device (S_IFCHR)', 0o040000: 'Directory (S_IFDIR)', From 274d775543e3962a49827fae7a30e36aa3edbcbf Mon Sep 17 00:00:00 2001 From: Thomas Hebb Date: Thu, 25 Sep 2025 22:18:58 -0400 Subject: [PATCH 3/3] efs_shell: Use lstat() instead of stat() to select rm command When removing a symlink, we want to know about the link itself and not its target to select between unlink() and rmdir(). --- src/modules/efs_shell_commands/rm.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/efs_shell_commands/rm.py b/src/modules/efs_shell_commands/rm.py index f48f7d4..bd430eb 100644 --- a/src/modules/efs_shell_commands/rm.py +++ b/src/modules/efs_shell_commands/rm.py @@ -27,28 +27,27 @@ def get_argument_parser(self, subparsers_object : _SubParsersAction) -> Argument def execute_command(self, diag_input, args : Namespace): - # First, emit a stat() (EFS2_DIAG_STAT) call in order to understand whether - # the remote path input by the user is a directory or not + # First, emit an lstat() (EFS2_DIAG_LSTAT) call in order to understand + # whether the remote path input by the user is a directory or not is_directory : bool = False opcode, payload = diag_input.send_recv(DIAG_SUBSYS_CMD_F, pack('