Subject: lseek()/read() to physical drive returning wrong data.
From: "Robin T. Miller" <[email-masked]>
To: [email-masked]
Date: Sat, 03 Feb 2001 12:47:49 -0500

Hi All,
	I have a Unix test program named 'dt' which runs with Cygwin.
This program tests a variety of devices as well as file systems.  The
tests which use lseek() to raw mounted disks, are failing with data
compare errors.  It appears either lseek() is positioning incorrectly
or read() is returning the wrong data after lseek'ing.

	This random I/O sequence seems to work correctly to a regular
file, so maybe the raw device buffering is messing up?  I'm not sure.

	The only other program restrictions is 32-bit file offsets.

	BTW: Are there any plans to release 64-bit file support?

	I'm attaching two files:
	1) a log file showing the failure,
	2) the output from 'cygcheck'.

	This is my first bug report, so I hope I'm including everything.

	In the log file, you'll see two tools used:
	- 'dt' (data test program) and
	- 'scu' (SCSI Command Utility).

	These tools can be found at the following URL's:

	    http://www.bit-net.com/~rmiller/dt.html (full source)
	    http://www.bit-net.com/~rmiller/scu.html (binary only)

	I could whip together a quick program to reproduce this problem,
but I thought providing the actual program and source might be easiest.
Plus I'd like to share these programs with others.

	The test steps performed in the log file are:
	- use 'scu' to write and verify a data pattern called IOT.  This
	  pattern has the lba encoded in the first 4 bytes of each block.
	  [ Note: 'scu' uses the SCSI pass-through.  'dt' can also write
	    the IOT data pattern. I hope this isn't confusing/misleading. ]
	- use 'dt' to read random blocks in the first 2 GBytes, which
	  shows a failure on the 2nd record.
	- use 'scu' to dump the failing block to verify the data is Ok.
	- a 'dt' example showing sequential reading of IOT works fine.
	- a 'dt' example showing random access to CD-ROM IOT file is Ok.

	Has anyone else seen any anomolies like this?

	Any help with this problem would be appreciated.

	I realize my test program is probably doing abnormal things :-)

	BTW:  Testing 'dt' with tapes works great, nice job Corinna!

Thanks in advance,
Robin Miller

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Fri Feb  2 17:36:26 2001

WinNT Ver 4.0 build 1381 Service Pack 5

Path:	/usr/local/bin
	/usr/bin
	/bin
	/cygdrive/c/WINNT/System32
	/cygdrive/c/vslick/win
	/cygdrive/c/program files/devstudio/sharedide/bin/ide
	/cygdrive/c/program files/devstudio/sharedide/bin
	/cygdrive/c/program files/devstudio/vc/bin
	/d/mssdk/bin
	/d/mssdk/bin/winnt
	/cygdrive/c/VisualGIPSY26/bin

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

PWD = `/d/rmiller/dt.d'
USER = `administrator'
MAKE_MODE = `unix'
HOME = `d:/rmiller'

INETSDK = `D:\MSSDK'
NUMBER_OF_PROCESSORS = `1'
PROMPT = `$P$G'
LOGONSERVER = `\\MEDA'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
COMSPEC = `C:\WINNT\system32\cmd.exe'
!C: = `C:\Cygwin\bin'
SYSTEMDRIVE = `C:'
HOSTNAME = `MEDA'
IMPRIMIS_BUILD_ROOT = `d:\imprimis'
INCLUDE = `c:\program files\devstudio\vc\include;c:\program files\devstudio\vc\atl\include;c:\program files\devstudio\vc\mfc\include;d:\mssdk\include;%include%'
PROCESSOR_REVISION = `0803'
MSDEVDIR = `C:\Program Files\DevStudio\SharedIDE'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
COMPUTERNAME = `MEDA'
STARTEAM = `C:\Program Files\StarTeam 4.0\StarTeam.ini'
STARTEAMAPP = `C:\Program Files\StarTeam 4.0'
WINDIR = `C:\WINNT'
USERPROFILE = `C:\WINNT\Profiles\Administrator'
BKOFFICE = `D:\MSSDK\'
BASEDIR = `D:\DDK'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
MACHTYPE = `i686-pc-cygwin'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 8 Stepping 3, GenuineIntel'
WIN32DMIPATH = `c:\dmi\win32'
OS = `Windows_NT'
OLDPWD = `/d/rmiller'
BASEMAKE = `D:\MSSDK\Include\bkoffice.mak'
DDKDRIVE = `D:'
PROCESSOR_ARCHITECTURE = `x86'
TEMP = `/cygdrive/c/TEMP'
EDITOR = `emacs'
PROCESSOR_LEVEL = `6'
SYSTEMROOT = `C:\WINNT'
NTIOM = `d:\imprimis'
WORKSTATIONID = `C:\Program Files\StarTeam 4.0\ConnectionManager.ini'
HOMEDRIVE = `C:'
LIB = `c:\program files\devstudio\vc\lib;c:\program files\devstudio\vc\mfc\lib;d:\mssdk\lib;%lib%'
MSTOOLS = `D:\MSSDK'
SHLVL = `1'
MSSDK = `D:\MSSDK'
HOMEPATH = `\'
USERDOMAIN = `MEDA'
USERNAME = `Administrator'
SHELL = `/bin/sh'
CPU = `i386'
MKS_TK_PATH_BACK = `c:\mksnt;C:\PROGRA~1\Plus!\MICROS~1\;;c:\dmi\win32\bin;C:\WINNT\system32;C:\WINNT;D:\DDK\bin;D:\MSSDK\Bin;D:\MSSDK\Bin\WinNT;C:\PROGRA~1\Tcl\bin;C:\PROGRA~1\TclPro1.4\win32-ix86\bin'
HOSTTYPE = `i686'
GHTMLVIEWER = `C:\PROGRA~1\Netscape\COMMUN~1\Program\netscape.exe'
OSTYPE = `cygwin'
TERM = `cygwin'
STLICENSE = `C:\Program Files\StarTeam 4.0'
_ = `/usr/bin/cygcheck'
TZ = `EST5EDT4,M4.1.0/2,M10.5.0/2'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `C:\Cygwin'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/d
  (default) = `d:'
  flags = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/dev/nrmt0
  (default) = `\\.\tape0'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/dev/PhysicalDrive3
  (default) = `\\.\PhysicalDrive3'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/dev/rmt0
  (default) = `\\.\tape0'
  flags = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `C:/Cygwin/bin'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `C:/Cygwin/lib'
  flags = 0x00000002
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
  (default) = `\\.\physicaldrive5'
  unix = `/dev/rdsk5'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
  (default) = `\\.\e:'
  unix = `/dev/cdrom0'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
  (default) = `C:'
  unix = `/'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1D

a:  fd           N/A    N/A                    
c:  hd  NTFS    8032Mb  32% CP CS UN PA FC     DRIVE_C
d:  hd  NTFS   17359Mb  29% CP CS UN PA FC     Robin's Extra Stuff
e:  cd  CDFS     500Mb 100%    CS              NT_IOT
f:  cd  CDFS     500Mb 100%    CS              NT_IOT
g:  hd  NTFS    8677Mb   1% CP CS UN PA FC     Extra Extra
h:  hd  NTFS   17364Mb   1% CP CS UN PA FC     Music Disk
p:  net NTFS    4090Mb  70% CP CS UN PA FC     
s:  net NTFS    4102Mb  87% CP CS UN PA FC     
z:  net NTFS    4090Mb  70% CP CS UN PA FC     

\\.\PhysicalDrive3  /dev/PhysicalDrive3  user    binmode
C:\Cygwin\bin  /usr/bin  user    binmode
C:\Cygwin\lib  /usr/lib  user    binmode
C:\Cygwin  /        user    binmode
\\.\tape0  /dev/rmt0  user    textmode
\\.\tape0  /dev/nrmt0  user    binmode
d:    /d       user    textmode

Found: C:\Cygwin\bin\bash.exe
Found: C:\Cygwin\bin\cat.exe
Found: C:\Cygwin\bin\cpp.exe
Found: C:\Cygwin\bin\find.exe
Found: C:\Cygwin\bin\gcc.exe
Found: C:\Cygwin\bin\gdb.exe
Found: C:\Cygwin\bin\ld.exe
Found: C:\Cygwin\bin\ls.exe
Found: C:\Cygwin\bin\make.exe
Found: C:\Cygwin\bin\sh.exe

  611k 2000/12/25 .\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2000/12/25 12:39
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 7
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 31
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Mon Dec 25 12:39:48 EST 2000
        shared id: cygwin1S3

  611k 2000/12/25 .\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2000/12/25 12:39
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 7
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 31
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Mon Dec 25 12:39:48 EST 2000
        shared id: cygwin1S3

   56k 2000/12/03 C:\Cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz21.0.dll" v0.0 ts=2000/11/20 18:53
   82k 2001/01/21 C:\Cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/1/21 15:39
   18k 2000/10/23 C:\Cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2000/10/22 22:26
   17k 2001/01/07 C:\Cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 23:34
   14k 2000/10/23 C:\Cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2000/10/23 15:02
   81k 2000/12/05 C:\Cygwin\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2000/11/25 20:43
   35k 2000/12/05 C:\Cygwin\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2000/11/25 20:43
   45k 2000/10/22 C:\Cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2000/10/22 19:06
  119k 2000/10/23 C:\Cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg6b.dll" v0.0 ts=2000/10/22 20:58
   53k 2001/01/21 C:\Cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/1/21 15:39
  414k 2001/01/21 C:\Cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/1/21 15:40
  299k 2001/01/21 C:\Cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/1/21 15:38
   34k 2001/01/21 C:\Cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/1/21 15:38
  162k 2000/10/23 C:\Cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng2.dll" v0.0 ts=2000/10/22 20:40
  108k 2001/01/07 C:\Cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 23:34
  390k 2000/12/05 C:\Cygwin\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2000/11/25 20:39
    5k 2000/12/05 C:\Cygwin\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2000/12/05 C:\Cygwin\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2000/11/25 20:39
  243k 2000/10/23 C:\Cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff3.dll" v0.0 ts=2000/10/22 21:14
  623k 2000/12/05 C:\Cygwin\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2000/11/25 20:43
   41k 2000/11/20 C:\Cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-noX4.dll" v0.0 ts=2000/11/19 21:41
   45k 2000/11/20 C:\Cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-X4.dll" v0.0 ts=2000/11/19 21:45
   49k 2000/10/23 C:\Cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2000/10/22 20:22
  611k 2000/12/25 C:\Cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2000/12/25 12:39
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 7
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 31
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Mon Dec 25 12:39:48 EST 2000
        shared id: cygwin1S3

Use -h to see help about each section

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple