public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Sam Edge <sam.edge@gmx.com>
To: cygwin@cygwin.com
Subject: Re: Wish list: Cygwin `mv` to move OneDrive files without downloading them
Date: Tue, 14 Jun 2022 16:32:21 +0100	[thread overview]
Message-ID: <2fa010d7-3258-742b-5dd6-5985905ce128@gmx.com> (raw)
In-Reply-To: <20220614112532.7hgkmwm5boz7rqre@lucy.dinwoodie.org>

On 14/06/2022 12:25, Adam Dinwoodie wrote:
 > Microsoft OneDrive has a "Files On-Demand" function, where it will
 > synchronise file metadata to a local system, but won't actually download
 > the file content until an application attempts to read the content.
 > When moving a file within Cygwin using `mv`, the file always gets
 > downloaded, which seems like it shouldn't be necessary.  Is there any
 > way to have `mv` (and presumably the underlying rename call) work
 > without downloading the file content in this circumstance? It'd
 > definitely make some of my life easier, but I'm not sure if it's a
 > trivial issue, one that would require years of work, or somwhere in
 > between...
 >
 > As best I can tell, `mv` doesn't need to know the content of the file,
 > at least as long as it's not moving the file outside of OneDrive; it
 > feels very similar to me to moving a file within a partition on *nix:
 > generally it's just a case of updating the directory records, with no
 > need to look at the file content.
 >
 > This does work as desired from within PowerShell: PowerShell's
 > `Move-Item` won't download a file that's not currently stored on the
 > local system.  So it's presumably possible to achieve this, although I
 > don't know if it'd rely on non-public Microsoft APIs, and/or lots more
 > complexity in the Cygwin code.
 >
 > Simple demonstration below, showing the different behaviours of
 > PowerShell versus Cygwin.  I've not included a cygcheck.out, as I'm
 > pretty sure this is much closer to a feature request than a problem
 > report, but let me know if I've got that wrong.

Greetings Adam.

I wasn't even aware you could do that with OneDrive - there's still no
Explorer
way of doing it in Windows 10 21H2 as far as I can see. Thanks for the
info. :-)

I imagine Cygwin doesn't know about the extended attributes being used
within
the local copy of your OneDrive directory so it is doing the move using the
underlying POSIX 'rename within mount' API which hopefully uses the Win32
'rename' but not in a way that carries the new 'O' attribute.

Presumably PowerShell's Move-Item does use the right flags to the Win32 API
call.

One of the problems the Cygwin maintainers have is that Microsoft introduces
'enhancements' to NTFS & the Win32 API arbitrarily in Windows updates
without
announcing them so it's a game of whack'a'mole.

--
Sam Edge

  reply	other threads:[~2022-06-14 15:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 11:25 Adam Dinwoodie
2022-06-14 15:32 ` Sam Edge [this message]
2022-06-14 15:46   ` Adam Dinwoodie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fa010d7-3258-742b-5dd6-5985905ce128@gmx.com \
    --to=sam.edge@gmx.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).