edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] directory mode and broken symlinks
@ 2015-04-23  0:49 Tyler Spivey
  2015-04-23  1:09 ` Karl Dahlke
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tyler Spivey @ 2015-04-23  0:49 UTC (permalink / raw)
  To: edbrowse-dev

Rather odd one.
mkdir test
ln -s 1234 test/1234
ln -s /etc/hosts test/hosts

When I run edbrowse on test, I only get hosts@, not the 1234@ I also
expect to see there.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Edbrowse-dev]  directory mode and broken symlinks
  2015-04-23  0:49 [Edbrowse-dev] directory mode and broken symlinks Tyler Spivey
@ 2015-04-23  1:09 ` Karl Dahlke
  2015-04-23  2:09 ` Karl Dahlke
  2015-04-23  7:51 ` Karl Dahlke
  2 siblings, 0 replies; 6+ messages in thread
From: Karl Dahlke @ 2015-04-23  1:09 UTC (permalink / raw)
  To: edbrowse-dev

It's funny; I just ran into this bug last week.
I made a note to myself to look into it.
It's almost certainly the failure to determine the type,
to append the suffix character,
and the failure of this test probably prevents the entry from showing up.

Karl Dahlke

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Edbrowse-dev]  directory mode and broken symlinks
  2015-04-23  0:49 [Edbrowse-dev] directory mode and broken symlinks Tyler Spivey
  2015-04-23  1:09 ` Karl Dahlke
@ 2015-04-23  2:09 ` Karl Dahlke
  2015-04-23  7:51 ` Karl Dahlke
  2 siblings, 0 replies; 6+ messages in thread
From: Karl Dahlke @ 2015-04-23  2:09 UTC (permalink / raw)
  To: edbrowse-dev

Ok my first guess was wrong.
The broken symbolic link is not present in the array returned by glob().
The bug, if it is a bug, is part of glob,
and there is no practical way for us to circumvent it.
I either abandon glob() or document it somewhere that broken symblinks
might not show up.
This happens whether I use the flag GLOB_ERR or not.

Karl Dahlke

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Edbrowse-dev]  directory mode and broken symlinks
  2015-04-23  0:49 [Edbrowse-dev] directory mode and broken symlinks Tyler Spivey
  2015-04-23  1:09 ` Karl Dahlke
  2015-04-23  2:09 ` Karl Dahlke
@ 2015-04-23  7:51 ` Karl Dahlke
  2015-04-26 13:10   ` Adam Thompson
  2 siblings, 1 reply; 6+ messages in thread
From: Karl Dahlke @ 2015-04-23  7:51 UTC (permalink / raw)
  To: edbrowse-dev

Ok - I went back to opendir readder etc and it fixes your bug,
broken symlinks now appear.
And it's less code than setting up for glob().
I still need glob for expanding wildcards in filenames.
No mistake about that.
My home grown version wasn't very good.
It only expanded wildcards at the end, not the middle of the path.
So I'm glad we did this work, but as for a simple directory scan,
as Adam pointed out, glob is overkill -
and it did introduce at least one small bug.

With the scan back under our control, the sort is also under our control.
I use strcmp because it's easy, but should I be using strcoll?
In other words, should the sort always be ascii coalating,
or should the user be able to control it through his LC variables?
Maybe in an ideal world it should run like ls, however that sorts,
and maybe that's what strcoll would do, I'm not sure.

Karl Dahlke

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Edbrowse-dev] directory mode and broken symlinks
  2015-04-23  7:51 ` Karl Dahlke
@ 2015-04-26 13:10   ` Adam Thompson
  2015-04-27 20:02     ` Karl Dahlke
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Thompson @ 2015-04-26 13:10 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

On Thu, Apr 23, 2015 at 03:51:22AM -0400, Karl Dahlke wrote:
> Ok - I went back to opendir readder etc and it fixes your bug,
> broken symlinks now appear.
> And it's less code than setting up for glob().

Yeah, this is a good change I think.

> I still need glob for expanding wildcards in filenames.
> No mistake about that.
> My home grown version wasn't very good.
> It only expanded wildcards at the end, not the middle of the path.
> So I'm glad we did this work, but as for a simple directory scan,
> as Adam pointed out, glob is overkill -
> and it did introduce at least one small bug.

We also get full globbing this way (i.e. character ranges and the ?
metacharacter).

> With the scan back under our control, the sort is also under our control.
> I use strcmp because it's easy, but should I be using strcoll?
> In other words, should the sort always be ascii coalating,
> or should the user be able to control it through his LC variables?
> Maybe in an ideal world it should run like ls, however that sorts,
> and maybe that's what strcoll would do, I'm not sure.

Yeah we should really be using strcoll in this case.
The call is exactly the same as strcmp and it's just as portable according to
the standards.

Cheers,
Adam.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Edbrowse-dev]   directory mode and broken symlinks
  2015-04-26 13:10   ` Adam Thompson
@ 2015-04-27 20:02     ` Karl Dahlke
  0 siblings, 0 replies; 6+ messages in thread
From: Karl Dahlke @ 2015-04-27 20:02 UTC (permalink / raw)
  To: edbrowse-dev

> Yeah we should really be using strcoll in this case.

Done.
I set LC_COLLATE=en_US to test,
then back to LC_COLLATE=C.
Each time /bin/ls -a -1 gives all the files in the same order
as when edbrowse looks in the directory with hidden files active.
I updated the documentation accordingly.

Karl Dahlke

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-27 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-23  0:49 [Edbrowse-dev] directory mode and broken symlinks Tyler Spivey
2015-04-23  1:09 ` Karl Dahlke
2015-04-23  2:09 ` Karl Dahlke
2015-04-23  7:51 ` Karl Dahlke
2015-04-26 13:10   ` Adam Thompson
2015-04-27 20:02     ` Karl Dahlke

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 NNTP newsgroup(s).