Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/modules/efs_shell_commands/ln.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,8 +33,8 @@ def execute_command(self, diag_input, args : Namespace):
opcode, payload = diag_input.send_recv(DIAG_SUBSYS_CMD_F, pack('<BH',
DIAG_SUBSYS_FS, # Command subsystem number
EFS2_DIAG_SYMLINK,
) + args.remote_newlink.encode('latin1').decode('unicode_escape').encode('latin1') + b'\x00'
+ args.remote_target.encode('latin1').decode('unicode_escape').encode('latin1') + b'\x00', accept_error = True)
) + args.remote_target.encode('latin1').decode('unicode_escape').encode('latin1') + b'\x00'
+ args.remote_newlink.encode('latin1').decode('unicode_escape').encode('latin1') + b'\x00', accept_error = True)

if opcode != DIAG_SUBSYS_CMD_F:
print('Error executing SYMLINK: %s received with payload "%s"' % (
Expand Down
13 changes: 6 additions & 7 deletions src/modules/efs_shell_commands/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('<BH',
DIAG_SUBSYS_FS, # Command subsystem number
EFS2_DIAG_STAT,
EFS2_DIAG_LSTAT,
) + args.path.encode('latin1').decode('unicode_escape').encode('latin1') + b'\x00', accept_error = True)

if opcode != DIAG_SUBSYS_CMD_F:

print('Error executing STAT: %s received with payload "%s"' % (message_id_to_name.get(opcode, opcode),
print('Error executing LSTAT: %s received with payload "%s"' % (message_id_to_name.get(opcode, opcode),
repr(payload)))
return

(cmd_subsystem_id, subcommand_code,
errno, file_mode, file_size, num_links,
atime, mtime, ctime) = unpack('<BH7i', payload)
errno, file_mode, atime, mtime, ctime) = unpack('<BH5i', payload)

if errno:
print('Error executing STAT: %s' % (EFS2_ERROR_CODES.get(errno) or strerror(errno)))
print('Error executing LSTAT: %s' % (EFS2_ERROR_CODES.get(errno) or strerror(errno)))
return

if file_mode & 0o170000 == 0o040000: # S_IFDIR
Expand Down
1 change: 1 addition & 0 deletions src/protocol/efs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}

EFS2_FILE_TYPES = {
0o000000: 'Unknown',
0o010000: 'FIFO (S_IFIFO)',
0o020000: 'Character device (S_IFCHR)',
0o040000: 'Directory (S_IFDIR)',
Expand Down