Last Comment Bug 169506 - nsLocalFileUnix have problems with BeOS. IsExecutable()...
: nsLocalFileUnix have problems with BeOS. IsExecutable()...
Status: RESOLVED FIXED
: helpwanted
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: x86 BeOS
: -- normal (vote)
: Future
Assigned To: tqh
: Scott Collins
Mentors:
Depends on:
Blocks: 145860 266252 276378
  Show dependency treegraph
 
Reported: 2002-09-18 12:03 PDT by Sergei Dolgov
Modified: 2005-01-30 01:25 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch for IsXRW group of methods (1.65 KB, patch)
2002-09-26 13:27 PDT, Sergei Dolgov
dougt: review+
scc: superreview+
Details | Diff | Review
Patch with comment (2.02 KB, patch)
2002-10-04 11:53 PDT, Sergei Dolgov
beos: review+
beos: superreview+
Details | Diff | Review
Patch that complements previous patch and fix ENOENT (4.31 KB, patch)
2004-12-29 03:38 PST, tqh
no flags Details | Diff | Review
Updated to HEAD - still the same patch by tqh (4.67 KB, patch)
2005-01-01 15:30 PST, Niels Reedijk
no flags Details | Diff | Review
Updated patch (4.17 KB, patch)
2005-01-16 04:54 PST, tqh
sergei_d: review+
dougt: superreview+
Details | Diff | Review

Description Sergei Dolgov 2002-09-18 12:03:17 PDT
For example, access() POSIX function returns always 0, inspite real status/mode.
(used in IsExecutable, IsWritable, IsReadable)
This is partly bugginess, partly specifics of BeOS POSIX layer implementation.
For example, http://bugzilla.mozilla.org/show_bug.cgi?id=145860 depends on this
bugginess.
I think that right idea is to fork at last nsLocalFileBeOS from nsLocalFileUnix
and starting step-by-step rewrite.
Comment 1 Doug Turner (:dougt) 2002-09-18 17:28:50 PDT
feel free to reasign to a beos owner.
Comment 2 Sergei Dolgov 2002-09-19 06:12:32 PDT
setting dependency
Comment 3 Sergei Dolgov 2002-09-26 13:27:15 PDT
Created attachment 100758 [details] [diff] [review]
Patch for IsXRW group of methods

Using stat() instead access()
Comment 4 Scott Collins 2002-10-04 10:04:10 PDT
Comment on attachment 100758 [details] [diff] [review]
Patch for IsXRW group of methods

sr=scc.

I think this requires module owner review from dougt with an analysis (or at
least an explanation) from dougt as to why |stat| instead of |access|.
Comment 5 Scott Collins 2002-10-04 10:06:21 PDT
or rather, why not |stat| instead of |access| universally, so that separate
implementations aren't needed...
Comment 6 Doug Turner (:dougt) 2002-10-04 10:53:59 PDT
Comment on attachment 100758 [details] [diff] [review]
Patch for IsXRW group of methods

according to sergei_d@fi.tartu.ee, access is buggy on BeOS.

r=dougt if you put a comment under the #ifdef XP_BEOS stating this.

btw, do you require me to check this in?
Comment 7 Sergei Dolgov 2002-10-04 11:46:39 PDT
"btw, do you require me to check this in?"
Yes, i do, because i haven't permissions.
Comment 8 Sergei Dolgov 2002-10-04 11:53:43 PDT
Created attachment 101730 [details] [diff] [review]
Patch with comment

Same as previous, but has comment after #ifdef BEOS
Comment 9 Paul 2002-10-04 13:03:10 PDT
I can check this in tonight, as I've been told that I am the port lead for BeOS
and have CVS access.
Comment 10 Doug Turner (:dougt) 2002-10-04 14:28:36 PDT
great.  over to you...
Comment 11 Sergei Dolgov 2002-10-04 14:31:16 PDT
Comment on attachment 101730 [details] [diff] [review]
Patch with comment

Opps. Additionaly removed warning (sometimes even compile error) about
assigning const char * Path() to char * resolved_path_ptr in XP_BEOS part of
NS_IMETHODIMP
nsLocalFile::Normalize()(get tired to fix such things every time manually -
explicit casting is Good Thing (TM)).
Comment 12 Sergei Dolgov 2002-10-04 14:33:14 PDT
Doug, does it need r= again? Scott allowed me to forward sr from previous patch.
Comment 13 Paul 2002-10-04 14:59:33 PDT
Comment on attachment 101730 [details] [diff] [review]
Patch with comment

r=arougthopher
sr=scc (as per sergei's comments)

I will check this in as soon as the tree re-opens
Comment 14 Paul 2002-10-05 12:16:14 PDT
This has been checked in.
Comment 15 tqh 2004-12-29 03:31:26 PST
Reopening, the patch commited does not take into account that ENOENT should not
return an error.
Comment 16 tqh 2004-12-29 03:38:14 PST
Created attachment 169808 [details] [diff] [review]
Patch that complements previous patch and fix ENOENT

Patch to fix ENOENT, also includes correct behaviour for Reveal, Exists is also
moved away from the buggy access implementation.
Comment 17 Niels Reedijk 2004-12-29 09:04:35 PST
Reassigning to tqh. 

I'm looking at it right now.
Comment 18 Niels Reedijk 2004-12-29 09:19:23 PST
1. It doesn't apply cleanly on the MAIN branch (your name is rejected)
   Please note that the formatting of the header has changed (make sure you
check it)
2. Your second hunk deletes a newline. Why?
3. In the third hunk you have two newlines between Exists() and IsWritable(). 
4. Could you explain why ENOENT is a good condition? If you have a path that
doesn't exist, how can you say it is writable?

Remember, I'm just nagging. This is shared code and it should look as nice as
possible. One small question though. Exactly what kind of bugs does this fix?
Comment 19 tqh 2004-12-29 09:35:06 PST
(In reply to comment #18)
> 1. It doesn't apply cleanly on the MAIN branch (your name is rejected)
>    Please note that the formatting of the header has changed (make sure you
> check it)
> 2. Your second hunk deletes a newline. Why?
> 3. In the third hunk you have two newlines between Exists() and IsWritable(). 
> 4. Could you explain why ENOENT is a good condition? If you have a path that
> doesn't exist, how can you say it is writable?
> 
> Remember, I'm just nagging. This is shared code and it should look as nice as
> possible. One small question though. Exactly what kind of bugs does this fix?

1. Ah well I'm still on AVIARY unfortunatly so I have to get the new tree.
2. 3. Because I've done major work and checking and those slipped thru.
4. These functions are defined as 'do not fail if not existant'. Just return
false. At least that's how they are used under Windows / Unix and the access
documentation says the same so I assume that's correct. 
Comment 20 tqh 2004-12-29 10:02:54 PST
It fixes downloading, Otherwise you will get a lot of JS-crashes in some JS file
if you don't specify 'Ask me where to save'. Probably Downloads.js. It may not
show without bug 276378 applied. Also it probably fixes a lot under the hood. 
Comment 21 Niels Reedijk 2005-01-01 15:30:23 PST
Created attachment 170048 [details] [diff] [review]
Updated to HEAD - still the same patch by tqh
Comment 22 Wan-Teh Chang 2005-01-03 14:54:31 PST
Comment on attachment 170048 [details] [diff] [review]
Updated to HEAD - still the same patch by tqh

>-#ifdef XP_BEOS
>-// access() is buggy in BeOS POSIX implementation, at least for BFS, using stat() instead
>+
> NS_IMETHODIMP
> nsLocalFile::IsWritable(PRBool *_retval)
> {
>     CHECK_mPath();
>     NS_ENSURE_ARG_POINTER(_retval);
>     struct stat buf;
>     *_retval = (stat(mPath.get(), &buf) == 0);
>     *_retval = *_retval && (buf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH ));
>-    if (*_retval || errno == EACCES)
>+    if (*_retval || errno == EACCES || errno == ENOENT)

'errno' should be read only if a library function
call has failed.

If the stat() call succeeds (returns 0) but the
file is not writable, the above code will set
*_retval to 0, and proceed to read errno (for
comparison with EACCES and ENOENT).  In this case,
the value of errno is garbage.
Comment 23 tqh 2005-01-04 00:07:21 PST
Ah, good point, I was going to say that we have the 'stat(..) == 0' in there but
then on the next line we may set *_retval to false anyway. I'll fix that during
the day.
Comment 24 Niels Reedijk 2005-01-14 00:29:22 PST
tqh, could you fix this patch? I'd really like to include it (working) in a next
build. Thanks.
Comment 25 tqh 2005-01-14 04:01:18 PST
Yes, in fact I thought I already had, but I see now that I never uploaded it
here. Thanks for reminding me.
Comment 26 tqh 2005-01-16 04:54:59 PST
Created attachment 171405 [details] [diff] [review]
Updated patch

This should be the latest version. I am having some troubles with my computer,
so not 100% sure. Also tried to improve formatting and added a reference to
this bug so that we know why this was done.
Comment 27 tqh 2005-01-17 08:23:25 PST
Comment on attachment 171405 [details] [diff] [review]
Updated patch

I believe this one to be ok, r?
Comment 28 Sergei Dolgov 2005-01-17 09:00:38 PST
Comment on attachment 171405 [details] [diff] [review]
Updated patch

r=sergei_d

Hope no more buggy access() cases for BeOS
Comment 29 tqh 2005-01-19 08:19:56 PST
Comment on attachment 171405 [details] [diff] [review]
Updated patch

sr?
Comment 30 Doug Turner (:dougt) 2005-01-28 15:13:44 PST
Comment on attachment 171405 [details] [diff] [review]
Updated patch

looks fine.
Comment 31 Niels Reedijk 2005-01-30 01:25:25 PST
Checked in by timeless

Note You need to log in before you can comment on or make changes to this bug.


Privacy Policy