Workaround: Use upload (if possible).
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279>
Midnight Commander <https://midnight-commander.org>
Midnight Development Center
Comment (by opty):
''ls --full-time'' without Perl (like !OpenWrt), ''%S'' in ''strftime()''
with Perl and ''D'' instead of ''d'' in both.
Unfortunately, Perl's nanoseconds support through Time::!HiRes seems
problematic (floating point representation), so prefer ls over Perl?
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:1>
Comment (by opty):
Trying to use ''%S'' with ''D'' in Perl leads to timezone (DST in my case)
problem due to ''mktime(3)'' in C but just adding '':%S'' to
''strftime()'' and keeping the ''d'' seems to work.
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:2>
Comment (by opty):
So far (seconds):
{{{
#!diff
--- old/usr/libexec/mc/fish/ls 2018-06-05 05:12:34.000000000 +0000
+++ new/usr/libexec/mc/fish/ls 2021-09-14 14:00:11.706049876 +0000
@@ -5,21 +5,21 @@
fish_list_lsq ()
{
FISH_DIR="$1"
-ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
-while read p l u g s m d y n; do
+ls -Qan --full-time "${FISH_DIR}" 2>/dev/null | grep '^[^cbt]' | (
+while read p l u g s d t z n; do
echo "P$p $u.$g"
echo "S$s"
- echo "d$m $d $y"
+ echo "d${d#*-}-${d%%-*} ${t%.*}"
echo ":$n"
echo
done
)
-ls -Qlan "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
-while read p l u g a i m d y n; do
+ls -Qan --full-time "${FISH_DIR}" 2>/dev/null | grep '^[cb]' | (
+while read p l u g a i d t z n; do
echo "P$p $u.$g"
echo "E$a$i"
- echo "d$m $d $y"
+ echo "d${d#*-}-${d%%-*} ${t%.*}"
echo ":$n"
echo
done
@@ -130,7 +130,7 @@
if (opendir (DIR, $dirname)) {
while((my $filename = readdir (DIR))){
my
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
= lstat("$dirname/$filename");
- my $mloctime= strftime("%m-%d-%Y %H:%M", localtime $mtime);
+ my $mloctime= strftime("%m-%d-%Y %H:%M:%S", localtime $mtime);
my $strutils_shell_escape_regex =
s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'\''"\ \\])/\\$1/g;
my $e_filename = $filename;
$e_filename =~ $strutils_shell_escape_regex;
}}}
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:3>
Comment (by andrew_b):
`ls --full-time` is not portable. GNU ls has this option, but BSD hasn't.
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:4>
Comment (by zaytsev):
Well, BSD doesn't seem to have `-Q` either - on my Mac:
{{{
zaytsev@Yurys-MBP ~ % ls -Qlan
ls: illegal option -- Q
usage: ls [-@ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1%] [file ...]
}}}
BSD has `-T` though, which shows at least seconds, but GNU uses it for
something else :-(
I think that the helpers are named in a very confusing way:
* `fish_list_lsq` should be probably called `fish_list_gnu`
* `fish_list_sed` should be probably called `fish_list_bsd`
* `fish_list_poor_ls` should be probably called `fish_list_busybox`
This way the logic is more clear - Perl is used for maximal portability
wherever it's available to ensure consistent results - otherwise use plain
`ls` and POSIX stuff for three major userland types... At least this would
be my logic if I tried to come up with helpers myself :-)
Also it's very annoying that each block is copy & pasted twice... so much
for the use of functions.
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:5>
Comment (by musinsky):
Why not at least
{{{
< my $mloctime= strftime("%m-%d-%Y %H:%M:%S", localtime $mtime);
---
> my $mloctime= strftime("%m-%d-%Y %H:%M", localtime $mtime);
}}}
in {{{/usr/libexec/mc/fish/ls}}} file in {{{fish_list_perl ()}}} function
? this shows seconds.
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:6>
Comment (by zaytsev):
andrew_b: I think we can add seconds to the Perl function, I have checked
the code and it seems to call `vfs_parse_filedate`, which tries to get
seconds if they are there, but if not, it works anyways. Meaning there
shouldn't be an issue if one function returns seconds and the others do
not... so if full portable solution is not possible at the moment, at
least the situation will get less shitty for most of the users.
--
Ticket URL: <http://www.midnight-commander.org/ticket/4279#comment:7>