LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-05-2016, 07:43 AM   #1
L_Carver
Member
 
Registered: Sep 2016
Location: Webster MA USA
Posts: 241

Rep: Reputation: Disabled
Question Weird 'touch' issue -- one date will not 'touch' on a file.


I try "Sun March 13 2011 02:15:43" every way I can think of, and I still get an 'Invalid date format' error. However, if I make a change of even one day in either direction. or format another date the same way, it 'goes in,' that is, no error is returned.

Is it just my system, or could there be something wrong with the file (a JPG I downloaded in a browser no more than an hour ago)?

Carver
 
Old 11-05-2016, 08:05 AM   #2
L_Carver
Member
 
Registered: Sep 2016
Location: Webster MA USA
Posts: 241

Original Poster
Rep: Reputation: Disabled
It was the file.

I copied it to a USB thumb drive, "touched" it with the March 13 2011 date, and it passed. I had to re-touch it (that sounds odd somehow) after copying it back, since my thumb-drive was formatted NTFS, but that was no problem at all.

Sorry to bother anyone. No need to reply.

Carver
 
Old 11-05-2016, 10:26 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,812

Rep: Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666
you did not specify how did you really try that (and on which filesystem).
Actually it worked for me without any problem:
Code:
touch --date='Sun March 13 2011 02:15:43' file
Quote:
It was the file.
I do not really understand why.
https://en.wikipedia.org/wiki/Inode
 
1 members found this post helpful.
Old 11-05-2016, 11:07 AM   #4
L_Carver
Member
 
Registered: Sep 2016
Location: Webster MA USA
Posts: 241

Original Poster
Rep: Reputation: Disabled
I used
Code:
touch -d
a variable with the value of the date I mentioned in the first post, and then assigned different values to that variable to see which one would work. Interestingly, on my install, American dating (week-day, number of the day, month, year) works with "touch -d" about as often as SI dating does. US dating was among the approaches I tried.

Quote:
Originally Posted by pan64
I do not really understand why.
I've had it happen in the past (>= 2yrs ago) that corrupt files, files in a weak or bad block, and other unknown circumstances can make a file's system modified date unchangeable. Opening such a file in an appropriate app (I used EOG in this instance) and saving it somewhere you have write perms, then copying it back in Terminal "jiggles" it just enough to change the date. That's what I meant by "It was the file."

Carver

Last edited by L_Carver; 11-05-2016 at 11:11 AM.
 
Old 11-05-2016, 12:29 PM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,812

Rep: Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666
A corrupted filesystem will be detected by the os during boot and usually will be mounted as readonly. Sometimes during boot the os will also try to fix these problems and therefore next time it can be rw again. Regular usage, like opening files with any app cannot cause corruption. Anyway, a damaged filesystem must not be written and should be fixed as soon as possible (or replaced).
 
1 members found this post helpful.
Old 11-05-2016, 06:50 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,641
Blog Entries: 28

Rep: Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497
Just for grins and giggles I tried this on Slackware --Current ext4:

Code:
$ touch --date='Sun March 13 2011 02:15:43' file
touch: invalid date format 'Sun March 13 2011 02:15:43'
$ touch --date='Sun March 14 2011 02:15:43' file
$ ls -l file
-rw-r--r-- 1 frankbell users 0 Mar 14  2011 file
$ touch --date='Sun March 12 2011 02:15:43' file
$ ls -l file
-rw-r--r-- 1 frankbell users 0 Mar 12  2011 file
 
1 members found this post helpful.
Old 11-06-2016, 04:17 AM   #7
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,812

Rep: Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666
looks like a bug for me. How was your locale set?
Code:
pan@host:~$ pwd
/home/pan
pan@host:~$ touch file
pan@host:~$ touch --date='Sun March 12 2011 02:15:43' file; ls -l file
-rw-r--r-- 1 pan pan 0 Mar 12  2011 file
pan@host:~$ touch --date='Sun March 13 2011 02:15:43' file; ls -l file
-rw-r--r-- 1 pan pan 0 Mar 13  2011 file
pan@host:~$ touch --date='Sun March 14 2011 02:15:43' file; ls -l file
-rw-r--r-- 1 pan pan 0 Mar 14  2011 file
pan@host:~$
this is an ext4 filesystem and debian 8.6
 
1 members found this post helpful.
Old 11-06-2016, 08:35 PM   #8
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 17,641
Blog Entries: 28

Rep: Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497Reputation: 5497
Quote:
How was your locale set?
Code:
~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
 
1 members found this post helpful.
Old 11-06-2016, 10:32 PM   #9
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by L_Carver
However, if I make a change of even one day in either direction. or format another date the same way, it 'goes in,' that is, no error is returned.
An hour either way will work.

The problem is that 'March 13 2011 02:15:43' doesn't exist in the US due to daylight savings time (spring forward).

See here: https://www.gnu.org/software/coreuti...ing-right_002e

Code:
zdump -v US/Eastern | grep 2011
US/Eastern  Sun Mar 13 06:59:59 2011 UT = Sun Mar 13 01:59:59 2011 EST isdst=0 gmtoff=-18000
US/Eastern  Sun Mar 13 07:00:00 2011 UT = Sun Mar 13 03:00:00 2011 EDT isdst=1 gmtoff=-14400
US/Eastern  Sun Nov  6 05:59:59 2011 UT = Sun Nov  6 01:59:59 2011 EDT isdst=1 gmtoff=-14400
US/Eastern  Sun Nov  6 06:00:00 2011 UT = Sun Nov  6 01:00:00 2011 EST isdst=0 gmtoff=-18000
 
1 members found this post helpful.
Old 11-07-2016, 06:47 AM   #10
L_Carver
Member
 
Registered: Sep 2016
Location: Webster MA USA
Posts: 241

Original Poster
Rep: Reputation: Disabled
Reopening the thread as this discussion s/n/b discouraged from continuing.

So according to norobro, and the GNU folks, any date that happens to be the day of a time change in the USA is going to be hard to "touch" a date to, unless one specifies a non-US timezone/sets their system time to use one, This is very interesting.

Tangentially related (or at least it reminds me of it) is the late Douglas Adams quote in re the Y2K "bug" and Macs being immune to it: "We may not get everything right, but at least we knew the century was going to end." (Adams was an Apple Master, a 'title' few have anymore, so his using 'We' in this instance wasn't at all presumptuous.)

Carver
 
Old 11-07-2016, 06:57 AM   #11
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,812

Rep: Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666Reputation: 5666
not really, try: touch --date='Sun March 12 2011 04:15:43' file
only 0200-0300 is invalid. And this is acceptable, because you had to set your clock at 0200 to 0300.
 
Old 11-07-2016, 08:21 AM   #12
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,285
Blog Entries: 4

Rep: Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306Reputation: 3306
The definition of so-called .tzinfo files is very interesting ... and, very complete.

They not only contain the time-zone information for "right now," but also for every date in the past. Over the years as trigger-happy politicians have decided to move the dates around, and as different states or countries decide (for their own imperious reasons) to change how time-zones are to be handled, the "tzinfo" database grows to encompass it.

Thus, any date-time (in a particular "locale") can be translated to-and-from an absolute date ... or found to be, "it doesn't exist."
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TOUCH to change file modified date (Ubuntu) danielbmartin Programming 1 07-16-2015 06:52 AM
Injecting touch event on a touch screen LCD Driver ArunkumarRavi Programming 1 08-18-2014 10:23 AM
[SOLVED] Use date with touch to create new file with date based name craigjl Linux - Newbie 5 03-12-2010 09:46 AM
[SOLVED] group permissions: touch: cannot touch `filename': Permission denied bartonski Linux - General 2 11-27-2008 09:23 AM
Error - can't touch touch: /var/lock - filesystem problem? xanas3712 Linux - Newbie 0 05-10-2004 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration