delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/03/07/23:06:06

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=Wp+YVwO4qlHlbVoH
CqNieDiXQJcFWOND/jXRqdXhjgYUFfGyLMBnQtm4Zw7wExE5HfHKvPEhfZeQSjRW
eTOCaReG8LyhUmyqCUzd31soZEC7Z6ucnfnxvRLJGyODVSuGU8CDbeeRmbDqhxp3
7mHGX/aWdzfvY6RvPyeHCNayesc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=KzL4gmkBljXYe67BgXOBK6
EXpVs=; b=D2pvbPt5XIkbWUvOxxNFOgwWcPavG+YqKOqeUuiha1fGiSWO8ZgMbD
42+KVvR85YmTdlU3IZmdaOr8gGAkyonLXAEDJlpowEj5W4rDVHwBc1QJSZbiFnnJ
gn68zSkDxp81R3+O8bXPaXAnalp2nOHKswXLY1th78lein4NeYhBI=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:8.12.10, Hx-languages-length:707, pathname, penny
X-HELO: limerock01.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
Subject: Re: Symlink file size
To: cygwin AT cygwin DOT com
References: <58bf7c71 DOT d5c5ca0a DOT 98eda DOT 56bd AT mx DOT google DOT com>
From: Ken Brown <kbrown AT cornell DOT edu>
Message-ID: <cd015749-b18f-49c4-f5f4-194d07a079b7@cornell.edu>
Date: Tue, 7 Mar 2017 23:05:10 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
MIME-Version: 1.0
In-Reply-To: <58bf7c71.d5c5ca0a.98eda.56bd@mx.google.com>
X-PMX-Cornell-Gauge: Gauge=XXXXX
X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none;
X-IsSubscribed: yes

On 3/7/2017 10:37 PM, Steven Penny wrote:
> Cygwin seems to have no way to print an accurate size of a symlink.
> Consider
> this command:
>
>    $ touch alfa.txt
>    $ CYGWIN= ln -s alfa.txt bravo.txt
>
> Now cmd.exe can print the correct size just fine:
>
>    > dir /AS
>    2017-03-07  09:26 PM                30 bravo.txt
>
> However Cygwin prints incorrect 8 bytes with ls:
>
>    $ ls -l
>    total 2
>    -rw-r--r-- 1 Steven None 0 Mar  7 21:26 alfa.txt
>    lrwxrwxrwx 1 Steven None 8 Mar  7 21:26 bravo.txt -> alfa.txt

8 is the length of the file name "alfa.txt".  From 
https://linux.die.net/man/2/stat:  "The size of a symbolic link is the 
length of the pathname it contains, without a terminating null byte."

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019