mc: Add patch fixing shell links (closes #175)
[termux-packages] / packages / mc / mc-3611-fish-fix-perl-ls-helper.patch
1 From e274e58cb7dff1683480f5538fd1bfa41a85c0c7 Mon Sep 17 00:00:00 2001
2 From: Andreas Mohr <and@gmx.li>
3 Date: Sun, 13 Mar 2016 20:59:47 +0000
4 Subject: [PATCH] Fish: fix perl ls helper
5
6 With #3599 I introduce a perl warning in fish_list_perl()
7 so fish_list_perl() was skipped (return code 255) and fallback ls
8 function was used instead.
9
10 Plus all % chars must quoted because of g_strconcat() after reading
11 script file into string.
12
13 Fix it!
14
15 Signed-off-by: Andreas Mohr <and@gmx.li>
16 ---
17 src/vfs/fish/helpers/ls | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20 diff --git a/src/vfs/fish/helpers/ls b/src/vfs/fish/helpers/ls
21 index 1284e17..909a77d 100755
22 --- a/src/vfs/fish/helpers/ls
23 +++ b/src/vfs/fish/helpers/ls
24 @@ -138,8 +138,8 @@ while((my $filename = readdir (DIR))){
25 my $linkname = readlink ("$dirname/$filename");
26 $linkname =~ $strutils_shell_escape_regex;
27 printf("R%%o %%o $uid.$gid\nS$size\nd$mloctime\n:\"%%s\" -> \"%%s\"\n\n", S_IMODE($mode), S_IFMT($mode), $e_filename, $linkname);
28 - } elseif (S_ISCHR ($mode) || S_ISBLK ($mode)) {
29 - my $minor = $rdev % 256;
30 + } elsif (S_ISCHR ($mode) || S_ISBLK ($mode)) {
31 + my $minor = $rdev %% 256;
32 my $major = int( $rdev / 256 );
33 printf("R%%o %%o $uid.$gid\nE$major,$minor\nd$mloctime\n:\"%%s\"\n\n", S_IMODE($mode), S_IFMT($mode), $e_filename);
34 } else {