Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 04 May 2019 03:41:23 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 237740] dd(1) always report false error about lseek(2) after read(2) error with 'conv=noerror' / dd(1) wrongly lseek(2)ed input file on read(2) error with 'conv=noerror'
Message-ID:  <bug-237740-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237740

            Bug ID: 237740
           Summary: dd(1) always report false error about lseek(2) after
                    read(2) error with 'conv=3Dnoerror' / dd(1) wrongly
                    lseek(2)ed input file on read(2) error with
                    'conv=3Dnoerror'
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: msl0000023508@gmail.com

Created attachment 204204
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D204204&action=
=3Dedit
fix-dd-noerror-lseek.diff

Reporting 2 bugs in the same place.

In the latest revision 341257 of 'dd.c', at
https://svnweb.freebsd.org/base/head/bin/dd/dd.c?view=3Dlog , line 420, the=
 error
condition should be 'lseek(...) =3D=3D -1'. The code:
                        if (in.flags & ISSEEK &&
                            lseek(in.fd, (off_t)in.dbsz, SEEK_CUR))
should be:
                        if (in.flags & ISSEEK &&
                            lseek(in.fd, (off_t)in.dbsz, SEEK_CUR) =3D=3D -=
1)


Another bug is, when a read(2) error occurred, read(2) may actually read
something and change the file position then returning -1; when this happens=
 the
later lseek(2) call will over seeking the current position, skipping data t=
hat
unrelated to the first read(2) error.

The attached patch fix both bug.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-237740-227>