Subject: Bug opening folders in subdirectories ?

From: Warren Jones <[email-masked]>
Date: Tue, 14 Jul 1998 11:42:55 -0700

I've run into what looks like a bug in the way Pine 4.00 handles
folder collections with subdirectories.  To reproduce:

    1. Define *two* local folder collections.

    2. The *second* collection in your folder
       list should include a subdirectory.

    3. Go to your folder list ("L").

    4. Select the second folder collection.

    5. Select a subdirectory.

    6. Attempt to open a mail folder in the subdirectory.

    7. Pine reports: [Can't open mailbox ... no such folder]

But if you shuffle your folder list so that the collection with
a subdirectory comes first, pine will open a folder in the
subdirectory without any complaint!  Here's an example:

My .pinerc file defines two folder collections ...

    folder-collections="ECS mail folders" private/mail/folders/[],
	               "Unix mail folders" mail/[]

The second collection (mail/[]) contains a subdirectory named "apps".
In that subdirectory, there is a folder named "cscope".  When I go
to the "mail/apps" subdirectory, the screen looks like this:

    Local folders in mail/
    Dir: apps/
    <folders shown here>
    Now in directory: mail/apps/

When I select the "cscope" folder, I get this message:

   [ Can't open mailbox  mail//tekoa/usr7/wjones/mail/apps/cscope:
     no such folder ]

(My HOME directory is "/tekoa/usr7/wjones".)

Here's an excerpt from .pine-debug1:

	---- FOLDER LISTER ----
  About to open folder "/tekoa/usr7/wjones/mail/apps/cscope"    inbox: "INBOX"
  Close - saved inbox state: max 4
  IMAP 09:14:23 7/14 mm_log ERROR:
  Can't open mailbox mail//tekoa/usr7/wjones/mail/apps/cscope: no such mailbox

"About to open" shows the correct folder.  Somewhere between there
and "Can't open mailbox", the folder path has been munged.

When I shuffle my folder list so that "mail/[]" comes first,
I can open "mail/apps/cscope" without any problem.

I've observed the same behavior under both Solaris 2.5 and Red Hat
Linux 4.1.  Any insights would be greatly appreciated.

--------------------------------------------------------------------
Warren Jones              | To keep every cog and wheel is the first
Fluke Corporation         | precaution of intelligent tinkering.
Everett, Washington, USA  |                          -- Aldo Leopold

-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: David Dyck <[email-masked]>
Date: Tue, 14 Jul 1998 20:55:36 -0700

similar to this, I used to read mail in other directories
by starting pine with

  pine -f $PWD/file.in.this.directory

and it would open the file as I desired

This doesn't work any more.

I did notice in the pine manual that:

       -f folder           Open  folder  (in first defined folder
                           collection) instead of INBOX.

it mentions the _first_ folder collection.  I wonder if
this is related to your problem.

On Tue, 14 Jul 1998, Warren Jones wrote:

> Date: Tue, 14 Jul 1998 11:42:55 -0700
> From: Warren Jones <[email-masked]>
> To: Pine Discussion Forum <[email-masked]>
> Subject: Bug opening folders in subdirectories ?
>

---

From: Terry Gray <[email-masked]>
Date: Tue, 14 Jul 1998 21:15:27 -0700 (Pacific Daylight Time)

David,
Try adding -c 0 to the argument list.
This tells Pine to interpret the -f argument as file system path,
rather than a name understood in the primary folder collection context.

(I don't think this solves Warren's problem however, which looks
suspiciously like a bug to me.)

-teg

> > folder collections with subdirectories.  To reproduce:

<etc>

---

From: David Dyck <[email-masked]>
Date: Tue, 14 Jul 1998 21:51:12 -0700

Thanks for your very quick reply.   Your suggestion was what I needed.

Perhaps this can be documented in the manual, as I would never
have guessed to add -c 0.

Maybe someone could suggest a way to interpret the man page
that would allow others to deduce this usefull information.

       -c context-number   context-number is  the  number  corre-
                           sponding  to  the folder-collection to
                           which the  -f  command  line  argument
                           should  be applied.  By default the -f
                           argument  is  applied  to  the   first
                           defined folder-collection.

Dave,

PS. I still needed to add the $PWD/ preceding the file name.

---

From: "Adam H. Kerman" <[email-masked]>
Date: Wed, 15 Jul 1998 10:08:34 -0500 (CDT)

>From: David Dyck <[email-masked]>
>Date: Tue, 14 Jul 1998 21:51:12 -0700

>>>I used to read mail in other directories by starting pine with

>PS. I still needed to add the $PWD/ preceding the file name.

Remember, the path assumed is relative to the default directory for saving
folders. So, if that's ~/mail, pine would look for the folder or collection
here.

I don't see how pine could find the collections relative to $PWD.

---

From: Edan Idzerda <[email-masked]>
Date: Wed, 15 Jul 1998 11:59:02 -0400 (EDT)

> I don't see how pine could find the collections relative to $PWD.

You're not seeing the point.  Some of us have files with mail in them
in other places.

Under 3.96
 
	% pine -f $PWD/folder

would open the folder in the current directory.

Under 4.00

	% pine -f $PWD/folder

pines does what you're suggesting, and tries to look for 
~/Mail/$PWD/folder.

In my opinion, that is dumb.  Pine should not try to find a relative
path when it's given an absolute one.  Sure, make it so that users
don't have to understand how directories work.  But if they try
to get tricky, let them fail or succeed the way one would expect it
to work, I say.

Yes,

	% pine -c 0 -f $PWD/folder

works, but that seems like a pain.  I think a better behavior would
be to assume '-c 0' when foldernames starts with '/' or "./" so that
I don't have to type as much.  :)

- edan

---

From: David Dyck <[email-masked]>
Date: Wed, 15 Jul 1998 09:16:23 -0700

Well stated, I hope this enhancement request goes through

On Wed, 15 Jul 1998, Edan Idzerda wrote:

> I think a better behavior would be to assume '-c 0' when foldernames
> starts with '/' or "./" so that I don't have to type as much.  :)

---

From: "Adam H. Kerman" <[email-masked]>
Date: Wed, 15 Jul 1998 13:43:07 -0500 (CDT)

This should go without saying. If you reply to the list, please don't Cc me.

>From: Edan Idzerda <[email-masked]>
>Date: Wed, 15 Jul 1998 11:59:02 -0400 (EDT)

>You're not seeing the point. Some of us have files with mail in them in other
>places.

All right. I could have added, "unless I cd to the directory containing the
collection," but I didn't. I don't care to do that each time I invoke pine
so I specify the relative path.

>In my opinion, that is dumb.

It does appear that pine is ignoring an environment variable. I assume you
verified that nothing else changed that would prevent this from being passed on
to pine.

>Pine should not try to find a relative path when it's given an absolute one.

Er, if I am relying on variable expansion, am I not by definition specifying a
relative path? It's only an absolute path if I specify it from root.

---

From: Edan Idzerda <[email-masked]>
Date: Wed, 15 Jul 1998 17:08:55 -0400 (EDT)

> This should go without saying. If you reply to the list, please don't Cc me.

My deepest apologies.

> so I specify the relative path.

No, I'm talking about when I'm IN a directory that contains a folder
that I wish to view.  I want to say 

    % pine -f ./folder

And not have Pine run off and open ~/Mail/./folder

Eh?  Ka-peesh?

> verified that nothing else changed that would prevent this from being passed on

Ah, I see for my example I should have said

    % echo $PWD
    /home/somewhere/edan/directory
    % pine -f $PWD/folder

Pine will try to open ~/Mail//home/somewhere/edan/directory/folder

THAT'S dumb!

> relative path? It's only an absolute path if I specify it from root.

Er, no.  If I enter

    % pine -f $PWD/folder

Pine doesn't know I typed $PWD, right?  I'm not expecting pine to do 
anything fancy.  When I give Pine a folder that starts with "./" or
"/" I want it to realize I am specifying an absolute path.

I will probably code it myself since I doubt its on the priority
list of the Pine developers, particularly since "-c 0" makes
it work that way.

- edan