Padding Flags Ignored by %x and %X (Date Utility)

2021-04-23 Thread sunnycemetery

A few examples:


■ export LANG=ja_JP.utf8
■ date +%-x
2021年04月23日
■ date +%_x
2021年04月23日
■ date +%-X
20時01分18秒


Is this intended behavior?  Here is what I expected:


■ date +%-x
2021年4月23日
■ date +%_x
2021年 4月23日
■ date +%-X
20時1分18秒


Thank you.



Re: find: locale affects results incorrectly

2020-08-09 Thread sunnycemetery

2020-08-07, 08:45, Eric Blake:
But POSIX says that the '*' glob only has to match characters, not  
encoding errors.


Thank you very much.  I was unaware of this.

I apologize for submitting to the wrong list.  It slipped my mind.



Re: date: unclosed date string comments

2020-08-07 Thread sunnycemetery

2020-08-06, 01:36, Kaz Kylheku (Coreutils):
This is a lack of diagnosis that adds up to it being a feature that  
a comment which does not close is closed implicitly by the end of  
the string.


I can certainly live with that.

Once this kind of thing escapes into the wild, the safest thing is to  
document it. A fix for this (like making date exit with a diagnostic and  
failed termination status) will break something for someone somewhere.


I agree.  Do you think I should submit a patch?

You can fix looseness in compilers more easily because when you  
tighten something in a compiler, the diagnostic blows up in the face  
of a developer.


If you tighten something in a utility, something breaks in the field,  
because it is a run-time check.


Well put.  The historical context was interesting as well.  Thank you.



find: locale affects results incorrectly

2020-08-07 Thread sunnycemetery

... possibly.  Please see for yourself:


■ LC_ALL=C ls -l
total 1
-rw-r--r-- 1 userx userx 0 Aug 7 08:35  
''$'\325\253\302\265\366''+'$'\325\361\275\322\374\253\322\342\203\322\351''+'$'\322\351\245\322\342\304\264''+'$'\364''rd'$'\264''+'$'\342''07.srt'

■ echo $LANG
ja_JP.utf8
■ find -name '*.srt'
■ LC_ALL=C find -name '*.srt'
./?+???+???+?rd?+?07.srt


I have attached logs of the following debug command for either locale,  
with ‘ and ’ replaced with ' for quick diff comparison.  Debug output  
does not elucidate much, but perhaps someone can shed light on how such  
a seemingly simple search could possibly fail (or even be affected by  
locale in the first place).



find -D all -name '*.srt'
Predicate List:
[(] [-name] [)] [-a] [-print]
Eval Tree:
pred=[-a] type=bi_op prec=and cost=Unknown est_success_rate=0.8000 no side 
effects
left:
pred=[-name *.srt] type=primary prec=no cost=Unknown 
est_success_rate=0.8000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Unknown est_success_rate=1.000 side 
effects
no children.
Normalized Eval Tree:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
left:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
no left.
right:
pred=[-name *.srt] type=primary prec=no cost=Nothing 
est_success_rate=0.8000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Nothing est_success_rate=1.000 side 
effects
no children.
-O2: promoting cheap predicate -name *.srt into name_list
predlist before merge sort:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no 
side effects
no left.
right:
pred=[-name *.srt] type=primary prec=no cost=Nothing 
est_success_rate=0.8000 no side effects
no children.
predlist after merge sort:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no 
side effects
no left.
right:
pred=[-name *.srt] type=primary prec=no cost=Nothing 
est_success_rate=0.8000 no side effects
no children.
Not an arm swap candidate (Right subtree has side-effects):
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
left:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
no left.
right:
pred=[-name *.srt] type=primary prec=no cost=Nothing 
est_success_rate=0.8000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Nothing est_success_rate=1.000 side 
effects
no children.
Not an arm swap candidate (Doesn't have two arms):
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
no left.
right:
pred=[-name *.srt] type=primary prec=no cost=Nothing 
est_success_rate=0.8000 no side effects
no children.
Not an arm swap candidate (Not a binary operation):
pred=[-name *.srt] type=primary prec=no cost=Nothing est_success_rate=0.8000 no 
side effects
no children.
Not an arm swap candidate (Not a binary operation):
pred=[-print] type=primary prec=no cost=Nothing est_success_rate=1.000 side 
effects
no children.
Optimized Eval Tree:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
left:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0.8000 no side 
effects
no left.
right:
pred=[-name *.srt] type=primary prec=no cost=Nothing 
est_success_rate=0.8000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Nothing est_success_rate=1.000 side 
effects
no children.
Optimized command line:
-name *.srt [est success rate 0.8] [real success rate 0/0=_] -a [est success 
rate 0.8] [real success rate 0/0=_] -print [est success rate 1] [real success 
rate 0/0=_]
consider_visiting (early): '.': fts_info=FTS_D , fts_level= 0, 
prev_depth=-2147483648 fts_path='.', fts_accpath='.'
consider_visiting (late): '.': fts_info=FTS_D , isdir=1 ignore=0 have_stat=1 
have_type=1
consider_visiting (early): 
'./\325\253\302\265\366+\325\361\275\322\374\253\322\342\203\322\351+\322\351\245\322\342\304\264+\364rd\264+\34207.srt':
 fts_info=FTS_NSOK, fts_level= 1, prev_depth=0 
fts_path='./\325\253\302\265\366+\325\361\275\322\374\253\322\342\203\322\351+\322\351\245\322\342\304\264+\364rd\264+\34207.srt',
 
fts_accpath='\325\253\302\265\366+\325\361\275\322\374\253\322\342\203\322\351+\322\351\245\322\342\304\264+\364rd\264+\34207.srt'
consider_visiting (late): 
'./\325\253\302\265\366+\325\361\275\322\374\253\322\342\203\322\351+\322\351\245\322\342\304\264+\364rd\264+\34207.srt':
 fts_info=FTS_NSOK, isdir=0 ignore=0 have_stat=0 have_type=1
./?+???+???+?rd?+?07.srt
consider_visiting (early): '.': fts_info=FTS_DP, fts_level= 0, prev_depth=1 
fts_path='.', fts_accpath='.'
consider_visiting (late): '.': fts_info=FTS_DP, isdir=1 

date: unclosed date string comments

2020-08-05 Thread sunnycemetery

Hello.  Given this documentation:

Comments may be introduced between round parentheses, as long as included  
parentheses are properly nested.


Is this considered a bug:


■ LC_ALL=C date -d '(test 1 2 3'
Wed Aug 5 00:00:00 EDT 2020
■ LC_ALL=C date -d '((test 1 2 3)'
Wed Aug 5 00:00:00 EDT 2020


Thank you.



Re: Feedback: ls

2020-05-01 Thread sunnycemetery

2020-04-25, 16:39, David Mooter:
The purpose of ls when on standard out is for the human eye to read  
the file names.


I agree.  In light of the following, however...


Yes, it can be turned off.


... and the fact that a good chunk of the people who would care about or  
even notice the difference already use aliases or shell functions instead  
of stock ls, generating traction for such a change could prove difficult.


Furthermore, added quotes *do* convey additional information without  
even interfering with character alignment... Now that I think about it,  
I consider quoting the more preferable default--though I certainly agree  
with some of your points.




Re: suggestion: /etc/dd.conf

2020-05-01 Thread sunnycemetery

2020-04-28, 15:46, Erik Auerswald:

You could consider using an alias, e.g.:

   alias ddusb "dd bs=4096 conv=fsync"

You could add this to your shell startup files, e.g., the ~/.bashrc file.   
Some GNU/Linux distributions read the file ~/.bash_aliases if it exists,  
with the intent to place alias definitions there.


This is a good suggestion.  I would like to add, however, that an alias  
(or function) in $BASH_ENV instead of ~/.bashrc has an added benefit  
of being available for other programs when the shell is not interactive  
(as with vim's command line, for example).




Re: [PATCH] sleep: allow ms suffix for milliseconds

2019-12-08 Thread sunnycemetery

On 2019-12-02 13:58, Stephane Chazelas wrote:

With GNU coreutils sleep (and ksh93's builtin but not that of
bash or mksh) one can add a e-3 suffix to get miliseconds (and
e-6 for us and e-9 for ns)

sleep 1 # s
sleep 1000e-3 # ms
sleep 100e-6 # us
sleep 10e-9 # ns


Thank you for the trick (and Berny for the documentation patch).   
It's new to me, but I guess that's what I get for not investigating the  
info page's notes.




Re: Wishing rmdir had a prompt

2019-10-23 Thread sunnycemetery

On 2019-09-02 17:22, Bernhard Voelker wrote:
 Just recently I've been asked (off-list) why src/true.c needs to have  
 80+ lines while 3 lines would be enough.


This piqued my curiosity.  Obvious comment header, localization, and  
--{help,version} fluff aside, I was not aware of the GNU-specific fringe  
case, outlined on the info page as steps to force true to produce a false  
return value.  It has been added to my list of party gags.