Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #222147

Re: unexpected behavior of cp and mv

From Alberto Sentieri <22t@tripolho.com>
Newsgroups linux.debian.user
Subject Re: unexpected behavior of cp and mv
Date 2020-04-30 16:20 +0200
Message-ID <A1icF-7ko-1@gated-at.bofh.it> (permalink)
References <A199n-1H1-1@gated-at.bofh.it> <A1eLL-53M-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Thanks.

By any chance is there a cifs specialist watching this thread?

Apparently the timestamp is initially correct but it changes after a 
while. Does anyone knows why? Is there a worker finishing the file copy, 
which could be creating this effect?

I wrote the following script to repeat my tests:

#!/bin/bash
rm -f /mnt/u1/rw/receipt/u1.crontab
/bin/stat /mnt/u1/rw/receipt/u1.crontab
/bin/cp -pi /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/
ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
/bin/stat /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
sleep 1
ls -ls /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab
/bin/stat /mnt/1g/home/u1/data/u1.crontab /mnt/u1/rw/receipt/u1.crontab

The result is this:

$ ./do_it.sh
/bin/stat: cannot stat '/mnt/u1/rw/receipt/u1.crontab': No such file or 
directory
4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
0 -rwxr-xr-x 1 u1 u1 54 Feb  5  2017 /mnt/u1/rw/receipt/u1.crontab
   File: /mnt/1g/home/u1/data/u1.crontab
   Size: 54            Blocks: 8          IO Block: 4096   regular file
Device: 831h/2097d    Inode: 58721601    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/      u1)   Gid: ( 1000/      u1)
Access: 2020-04-29 11:31:03.908624390 -0400
Modify: 2017-02-05 22:05:36.481422339 -0500
Change: 2017-02-05 22:05:36.581420492 -0500
  Birth: -
   File: /mnt/u1/rw/receipt/u1.crontab
   Size: 54            Blocks: 0          IO Block: 16384  regular file
Device: 2ch/44d    Inode: 75374568    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/      u1)   Gid: ( 1000/      u1)
Access: 2020-04-29 11:31:03.908624300 -0400
Modify: 2017-02-05 22:05:36.481422300 -0500
Change: 2020-04-30 10:04:07.613793700 -0400
  Birth: -
    4 -rw-r--r-- 1 u1 u1 54 Feb  5  2017 /mnt/1g/home/u1/data/u1.crontab
1024 -rwxr-xr-x 1 u1 u1 54 Apr 30 10:04 /mnt/u1/rw/receipt/u1.crontab
   File: /mnt/1g/home/u1/data/u1.crontab
   Size: 54            Blocks: 8          IO Block: 4096   regular file
Device: 831h/2097d    Inode: 58721601    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/      u1)   Gid: ( 1000/      u1)
Access: 2020-04-29 11:31:03.908624390 -0400
Modify: 2017-02-05 22:05:36.481422339 -0500
Change: 2017-02-05 22:05:36.581420492 -0500
  Birth: -
   File: /mnt/u1/rw/receipt/u1.crontab
   Size: 54            Blocks: 2048       IO Block: 16384  regular file
Device: 2ch/44d    Inode: 75374568    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/      u1)   Gid: ( 1000/      u1)
Access: 2020-04-29 11:31:03.908624300 -0400
Modify: 2020-04-30 10:04:07.611931500 -0400
Change: 2020-04-30 10:04:07.611931500 -0400
  Birth: -

On 4/30/20 6:39 AM, Thomas Schmitt wrote:
> Hi,
>
> Alberto Sentieri wrote:
>> I tried setfattr as you suggested with "user" and without "user". Both
>> failed with "Operation not supported" and none of them changed the
>> timestamp.
> This only leaves the idea to mimick the strace of cp -p in an own
> C program to see whether utimensat() has the desired effect and
> whether following calls spoil it.
> Maybe it is necessary to really create a new file and to write
> some realistic amount of data to it in order to set up the conditions
> for the problem.
>
> The code of cp.c and copy.c in
>    https://sources.debian.org/src/coreutils/8.30-3/src/
> looks not overly self-contained. So it might be difficult to get a
> debuggable version of cp, if not Debian package development magic can
> produce it.
>
>
> Have a nice day :)
>
> Thomas
>

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-29 19:10 +0200
  Re: unexpected behavior of cp and mv Roberto C. Sánchez <roberto@debian.org> - 2020-04-29 19:20 +0200
    Re: Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-29 20:50 +0200
    Re: Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-29 21:20 +0200
      Re: unexpected behavior of cp and mv David Wright <deblis@lionunicorn.co.uk> - 2020-04-30 03:50 +0200
        Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 06:20 +0200
  Re: unexpected behavior of cp and mv Charles Curley <charlescurley@charlescurley.com> - 2020-04-29 21:20 +0200
    Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-29 22:10 +0200
      Re: unexpected behavior of cp and mv "Thomas Schmitt" <scdbackup@gmx.net> - 2020-04-29 22:20 +0200
        Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-29 22:30 +0200
        Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-29 23:00 +0200
          Re: unexpected behavior of cp and mv "Thomas Schmitt" <scdbackup@gmx.net> - 2020-04-29 23:30 +0200
            Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 06:40 +0200
              Re: unexpected behavior of cp and mv "Thomas Schmitt" <scdbackup@gmx.net> - 2020-04-30 12:40 +0200
                Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 16:20 +0200
            Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 18:50 +0200
              Re: unexpected behavior of cp and mv "Thomas Schmitt" <scdbackup@gmx.net> - 2020-04-30 19:40 +0200
                Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 20:10 +0200
                Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 21:50 +0200
                Re: unexpected behavior of cp and mv The Wanderer <wanderer@fastmail.fm> - 2020-04-30 22:00 +0200
                Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 22:10 +0200
                Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 23:40 +0200
              Re: unexpected behavior of cp and mv David Wright <deblis@lionunicorn.co.uk> - 2020-04-30 20:00 +0200
          Re: unexpected behavior of cp and mv songbird <songbird@anthive.com> - 2020-04-30 00:00 +0200
            Re: unexpected behavior of cp and mv Alberto Sentieri <22t@tripolho.com> - 2020-04-30 06:10 +0200

csiph-web