Bug 2889 - dir command in OS/2 dos box shows ".." entry infinitely
Summary: dir command in OS/2 dos box shows ".." entry infinitely
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.20
Hardware: x86 FreeBSD
: P3 normal
Target Milestone: none
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-18 20:29 UTC by Alex Masterov
Modified: 2005-08-24 10:23 UTC (History)
0 users

See Also:


Attachments
Sniff running dir command from OS/2 dos box on samba drive (91.22 KB, application/octet-stream)
2005-07-18 20:36 UTC, Alex Masterov
no flags Details
Sniff running dir command from OS/2 dos box on samba 3.0.14a drive (4.34 KB, application/octet-stream)
2005-07-18 20:47 UTC, Alex Masterov
no flags Details
Proposed patch (1.51 KB, patch)
2005-07-19 10:20 UTC, Jeremy Allison
no flags Details
Sniff running dir command with patched samba 3.0.20 (56.54 KB, application/octet-stream)
2005-07-19 20:27 UTC, Alex Masterov
no flags Details
Sniff running dir command on samba 3.0.20rc1-SVN-build-8617 (58.87 KB, application/octet-stream)
2005-07-19 21:04 UTC, Alex Masterov
no flags Details
Sniff running dir from OS/2 dos box to Win2k Server (3.09 KB, application/octet-stream)
2005-07-20 19:29 UTC, Alex Masterov
no flags Details
Patch (4.19 KB, patch)
2005-07-21 13:18 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Masterov 2005-07-18 20:29:30 UTC
Executing command dir V: (V: is samba 3.0.20rc1-SVN-build-8571 drive) from OS/2
DOS BOX causes infinitive ".." entries.
Comment 1 Alex Masterov 2005-07-18 20:36:53 UTC
Created attachment 1317 [details]
Sniff running dir command from OS/2 dos box on samba drive

Here is the sniff of running dir command from OS/2 DOS BOX on a samba drive
command was:

C:\>dir v:

The volume label in drive V is share.
The Volume Serial Number is 1392:04E7.
Directory of V:\

.	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
..	     <DIR>	19.07.05 10:17
^C
Comment 2 Alex Masterov 2005-07-18 20:47:46 UTC
Created attachment 1318 [details]
Sniff running dir command from OS/2 dos box on samba 3.0.14a drive

Here is the sniff of running dir command from OS/2 DOS BOX on a samba 3.0.14a
drive
command was:
C:\>dir v:
[...]
37999434 DEF	    15	19.07.05  9:03
37999434 FON	    28	19.07.05  9:03
37999434 VUE	   291	19.07.05  9:03
OQN155~7	  4449	19.07.05 10:45
FPD26	 BUG <DIR>	19.07.05  9:03
      41 file(s)     663182 bytes used
		 1150287872 bytes free
Comment 3 Jeremy Allison 2005-07-18 22:12:55 UTC
Ok, I can see the problem - we're returning an invalid offset value
so subsequent seeks start at zero. It's a little late here so I'm going to
investigate and fix this in the morning. Thanks.
Jeremy.
Comment 4 Jeremy Allison 2005-07-19 10:20:31 UTC
Created attachment 1319 [details]
Proposed patch

I think the problem is that the top 16 bits of the "server state" field must be
non-zero. As we're using the 32 bit field as an offset then normally this field
will be zero. W2K3 fills this field with a counter enumerating the number of
SMBsearch calls on this directory - starting at 1. Add back the 1<<31 bit flag
DPTR_MASK to ensure this is non-zero - with better checks on use.
Jeremy.
Comment 5 Alex Masterov 2005-07-19 20:27:51 UTC
Created attachment 1320 [details]
Sniff running dir command with patched samba 3.0.20

Patch doesn't help :-(
I've applied it and recompiled samba. 
Dir from os/2 dos box prints ".." entries infinitively as in previous build.
Here is sniff of this.

I'll compile lastest SVN build of Samba and try again.
Comment 6 Alex Masterov 2005-07-19 21:04:30 UTC
Created attachment 1321 [details]
Sniff running dir command on samba 3.0.20rc1-SVN-build-8617

Problem still exists in samba 3.0.20rc1-SVN-build-8617
Here is sniff
Comment 7 Jeremy Allison 2005-07-19 22:29:15 UTC
Thanks for the updates - late night here again - I'll examine tomorrow morning.
Jeremy.
Comment 8 Jeremy Allison 2005-07-20 11:23:35 UTC
Ok, what I *really* need now to fix this is a sniff of OS/2 doing the same
directory listing to (preferably) Windows 2003. If not w2k3, then w2k or even
NT4 will do at a pinch. I really want to know what it returns in the flags2
field here. That's my current working theory.
Jeremy.
Comment 9 Alex Masterov 2005-07-20 19:29:27 UTC
Created attachment 1325 [details]
Sniff running dir from OS/2 dos box to Win2k Server 

Unfortunatly, there is not Win2003 Server in our network
Here is sniff running dir command from OS/2 DOS BOX to Win2K server drive.
Comment 10 Jeremy Allison 2005-07-21 11:52:04 UTC
Ok, I've managed to get a copy of OS/2 warp server for ebusiness running on my
Linux box with svista and I can't reproduce the problem. When I do a dir on a
mapped drive it does trans2 calls, not the old SMBsearch calls.
What version of OS/2 are you running and how do you reproduce this ?
Thanks,
Jeremy.
Comment 11 Jeremy Allison 2005-07-21 11:54:15 UTC
Never mind - I'm an idiot... I reproduced it in a DOS box. I'll work on it now...
Jeremy
Comment 12 Jeremy Allison 2005-07-21 13:18:09 UTC
Created attachment 1330 [details]
Patch
Comment 13 Jeremy Allison 2005-07-21 13:21:43 UTC
Ok, this fixes it for sure. Turns out the OS/2 dos box doesn't like two offsets
to be identical. Make offsets for . and .. different (and explicit).
Jeremy.
Comment 14 Alex Masterov 2005-07-21 21:08:46 UTC
Samba 3.0.20rc1-SVN-build-8695 works correctly.
Thank you!
Comment 15 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:23:43 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.