DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4B9DJiIA816694 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4B9DJiIA816694 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=hOoxx/AY X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9E35385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1733750383; bh=K+MUlx0uo6chanfZ9okVOQfZKSHT+Tt2397oM0BTSf0=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hOoxx/AYr+27p7rol0IYfISQiq699r3iCOwHrVEqPKVf5zbdMJ57K3d4HI737KHMa v7KcqsHma0B4dNtmP6up0NUJVkQNgA/NhZMZhknhMvfsUtt1xTkKl1DX5v2lOiyEmh 5D5wnsJLsqpAAXxafGoCQ9DzQ0/RZ5XQTk0F1yZY= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47D5A385828E Date: Mon, 9 Dec 2024 14:17:58 +0100 To: cygwin AT cygwin DOT com Subject: Re: cygpath and unc paths Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: <053d21b3-ee11-4858-a60d-54cd154fd98c AT kircheis DOT it> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <053d21b3-ee11-4858-a60d-54cd154fd98c@kircheis.it> X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Dec 9 13:47, Federico Kircheis via Cygwin wrote: > On 09/12/2024 12.46, Corinna Vinschen via Cygwin wrote: > > On Dec 6 13:23, Federico Kircheis via Cygwin wrote: > > > Hello, > > > > > > was it considered to add a flag to cygpath to output a path in unc format? > > > > No. But it wouldn't be much work. > > It would be very nice if it ever happens. > > > > For example, the folder > > > > > > C:\test. > > > > > > cannot be accessed from many Windows applications (powershell and cmd > > > included) because of the trailing dot, while cygwin has no issue creating, > > > accessing and deleting such files/folders. > > > > > > Using an unc path > > > > > > \\?\C:\test. > > > > > > solves the issue for some programs, but cygpath currently misses an option > > > for creating such path. > > > > As a workaround you can just prepend the long path prefix: > > > > echo -n '\\?\'; cygpath ... > > Which is what I'm doing, plus special-casing > > 1) > root path, like C:\ , because for whatever reason \\?\C:\ is not valid, it > has to be a subfolder (and trying to trick it with \\?\C:\\ does not work > either). In which scenario? \\?\C:\ is just the same as \??\C:\ in NT speak, and that's a perfectly valid directory path. > 2) > unmounted network drives (\\server\path) Yeah, those have a different prefix: \\?\UNC\server\share > I'm not sure how a --unc should handle those cases. > For all things I have in mind, not appending \\?\ is preferred, but someone > might expect a hard error. > > Either way, it is another reason why it makes sense for cygpath to handle > those cases, currently I have to parse it's output before prepending '\\?\'. I'll take a look. > > > Notice that creating a dos path leads to an error. > > > > I don't understand. Creating which DOS path with which application? > > I meant that it is not possible to create a DOS path to C:\test., thus using > a dos path is not a viable workaround to unc: > > ---- > > cd 'C:/test.' > > cygpath -ws . > cygpath: cannot create short name of . > ---- Don't use -s, it's just for the old short name style of DOS paths. Nobody should actually need this nowadays, and sometimes short paths don't even exist. It's a functionality inside the FS driver, afaik, and it can be switched off in the system. In your example, standard filenames work: $ cd /cygdrive/c $ mkdir test. $ cd test. $ cygpath -ws . cygpath: cannot create short name of C:\test. $ cygpath -wa . C:\test. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple