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/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237740

            Bug ID: 237740
           Summary: 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'
           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=204204&action=edit
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=log , line 420, the error
condition should be 'lseek(...) == -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) == -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 that
unrelated to the first read(2) error.

The attached patch fix both bug.

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

home | help

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