delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/23/17:05:36

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: "Ronald Landheer" <info AT rlsystems DOT net>
To: <cygwin AT cygwin DOT com>
Subject: [PATCH] ls & "magic" cygdrive dir (was: RE: cygdrive stuff)
Date: Sun, 23 Sep 2001 23:04:27 +0200
Message-ID: <NFBBLOMHALONCDMPGBLFOECJCCAA.info@rlsystems.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Importance: Normal

------=_NextPart_000_000A_01C14484.184DAC80
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello all,

After the overwhelming display of interest for my last mail on this =
subject (which had gone completely unnoticed as far as I can tell), I =
have patched up the patch I sent earlier to take care of a lacking =
feature.
Much of my original mail is still valid, so I'm re-posting:

-- BEGIN RE-POST --
> On Wed, Sep 19, 2001 at 04:11:52PM -0300, salvador wrote:
>> 1) "ls -la /" doesn't show any cygdrive directory. Note it could=20
>> be solved in the same way UNIX solves the /proc stuff, just mounting
>> over an existent directory a fake one.
>> 2) "ls -la /cygdrive" doesn't work.
> Correct.
> If you'd like to correct this, patches will be, as always,=20
> gratefully accepted.
I saw this, it itched me, so I'm attaching a patch :)

The patch I'm attaching is against the source 'ls.c' as found in=20
fileutils-4.1-1. It introduces three methods, of which one is called:=20
ls-cygwin-loop(). It is called whenever needed.

I've *only* tested this on a Win98 platform, but I don't think NT=20
changes anything in this case (I don't have any NT platforms here, so I=20
can't test them).

Here's how it works:

$ ls -la /
(..)
?---------    0 0        Sigma           0 Jan  1  1970 cygdrive
(..)

Note it only shows you that cygdrive exists. As there is no "magic dir"=20
filetype, and it's not a real directory, I'm not showing it as one. My=20
patch only does anything when there *is* no real directory - if it comes =

through a stat() call, it is not handled.

$ ls -la /cygdrive/
?---------    0 0        Sigma           0 Jan  1  1970 c
?---------    0 0        Sigma           0 Jan  1  1970 d
?---------    0 0        Sigma           0 Jan  1  1970 p
?---------    0 0        Sigma           0 Jan  1  1970 u

Note that 'ls -la /cygdrive' *only* shows:
?---------    0 0        Sigma           0 Jan  1  1970 cygdrive

The patch works regardless of the cygdrive setting, but does=20
(regrettably) not show the mounted drives if the cygdrive setting is=20
'/' and -an 'ls -la /' is done. I guess I should fix this, but the=20
problem is that the mounted drives come through a stat() call as a=20
directory, so I don't know whether or not they're really there -=20
ideas would help.

Everything where displaying etc. is concerned is handled by the old code =

- my code only adds stuff to the list and does so conservatively (so it=20
does not, for example, show the /usr/bin mount when an ls -la /usr is=20
done, unless the directory is really there, in which case ls would show=20
it anyway. (This is to avoid duplicates in the file list).

I lifted some code from mount - code used to see what mounts exist, and=20
what the cygdrive prefix is.. I've surrounded those by copyright notices =

attributing it to mount & Cygnus. The rest is my own (but I'm quite=20
willing to sign it over, if it's significant enough for any signatures:=20
I'm no lawyer, so I'm being conservative - this, ofcourse, only if it=20
proves useful enough to apply to ls..).

All code is surrounded by the magic __CYGWIN__ ifdefs - so no other=20
platforms should be affected at all. (However, I don't know how MinGW32=20
handles this, or how this goes along with the -mno-cygwin flag)
--- END RE-POST ---
In addition to this, my former patch didn't handle relative directories=20
(at all). I.e. running "ls ../../../.." from the "/usr/src/fileutils-
4.1-1/src" directory didn't show the /cygdrive magic dir, while "ls /"=20
did. This has been fixed by expanding the path as handled by the patch=20
to the full POSIX path.

Once again: this patch has *only* been tested on my development machine, =

because I do not have any other configurations available here. Please,=20
if you have other configurations, feel free to test it - it's only=20
prudent.

I hope this will be helpful (and won't go unnoticed this time) :)

Greetz!

Ronald

------=_NextPart_000_000A_01C14484.184DAC80
Content-Type: application/x-gzip;
	name="ls.c.diff.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="ls.c.diff.gz"

H4sIAL1MrjsAA+1ae3PTSBL/m3yKJltLJFu244RNNmHDweUCm6psoEjYZYujVLI0tofIGp80yuOo
fPfr7hlZDytAILtUXZECJ55HT08/ft09M71eD+KsH/ZVHN07yRM4EXPY2IThzu7Dzd3NLdhYXx+u
dLtdHlUdsbGx+9MW/jMjnjyB3nD4s7cFXfo1/BmePFmBH2QSxnkkYDXT6blIs3A2709Xqx2X2KNV
zK0r3R/kOBJj8P39P5//cXjs+9Rkh/6S6Uiq/vRxre0qG4RXkwuZtHTMgzSYtbRnOtCN5lmiRWIa
V7rUL0PIZaJnwaWvYaJGo1j4M5UnGpxQJZmGcBqk0EmCmXAfLaaYRpSVb5jyszBIahNGQSb8WGba
nwd6WpmKi1XmxUrNPzHvB5FEcgyDTkVc0BngBqjtdSYgCEORZYBkdKpioNkZqCS+gjyJRApBHIOe
ChirOFa46oSGRlJLXLe/AvhzomYCUGRazDJwXpw8e+jBYSovfzK/tlyYBueCiQRhDOM8CWm2B6Nc
Q6I0EyGRY29/CiqFSCVrGlDJMjHznh+cPt0/2j8+hVkQpqoPtAc2p+2H22xP2z/teNtsTwCpmOAu
kPdSOVrpIPZHsQrPMtiD9UdoSDhSpGmizPeumRlEtMU9UHOSXAqOVR52ohyd+3aEy0zDB8vE1rph
YnvTGw6ZC+oPYxGk/ljGAuVCNFptF/VwhIpEFnmr+6zbXjYXoRyjyrN8lKpckySci6kMp3AhUSVz
lN25zCSaHBiTmyvcbYYmYtTFq+qA+knf0LSbwiithZj94wI43nEScalRCLRZFkKxaxfu78Hx66Mj
u38SCa3k49IiFZkm4fFs145YyGhn46G3gzLaebjhDbcXMiqonAcx/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qKS+WHqcjFQpbNgGVQxnuoBwpecHnw/m/ncs5lvc5wgkqg8Qvjs4/PyVo+lj0V1FSYW4m08r7jp
4JmNeOk+zKxTeVdbvUX61MtaqL0BMNd31Lt8i8R3Y89wAGbWHXoYeUIN5QAzly5gb74A4YtyS7cQ
TG3NxuYqT0wafJeyW/LrCsEOSiXVWcectATmfs8UBnQdywWe4DsKeouWiPvlGctit8hVSdHapD1b
qg2y7wSqYlqDteqLpbKr2+WL4+dCQyqj4hVcbN/s8riK/9YuxM1VeEmq/tSn8mChOrzBSO3FQg0o
aw9zSgptZ+HWNnvD4kK3dnlbt1S2QmOp5WNP8yo6arzn/h8Zbfgsoy8AAA==


------=_NextPart_000_000A_01C14484.184DAC80
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_000A_01C14484.184DAC80--

- Raw text -


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