Bug 249248

Summary: cp: /dev/null: Invalid argument
Product: Base System Reporter: Katsuyuki Miyoshi <katsubsd>
Component: binAssignee: Alan Somers <asomers>
Status: Closed FIXED    
Severity: Affects Some People CC: doctorwhoguy, emaste
Priority: --- Keywords: regression
Version: CURRENT   
Hardware: Any   
OS: Any   
URL: https://reviews.freebsd.org/D26395
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249260

Description Katsuyuki Miyoshi 2020-09-11 09:28:31 UTC
===========================================
# cp /dev/null foo
cp: /dev/null: Invalid argument
#
===========================================

This message is output due to changes in r365549.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2020-09-11 20:20:05 UTC
^Triage: over to committer of r365549.
Comment 2 Alan Somers freebsd_committer freebsd_triage 2020-09-11 20:23:22 UTC
Fix is in code review
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-09-11 20:50:32 UTC
A commit references this bug:

Author: asomers
Date: Fri Sep 11 20:49:37 UTC 2020
New revision: 365643
URL: https://svnweb.freebsd.org/changeset/base/365643

Log:
  cp: fall back to read/write if copy_file_range fails

  Even though copy_file_range has a file-system agnostic version, it still
  fails on devfs (perhaps because the file descriptor is non-seekable?) In
  that case, fallback to old-fashioned read/write. Fixes
  "cp /dev/null /tmp/null"

  PR:		249248
  Reported by:	Michael Butler
  Reviewed by:	mjg
  MFC-With:	365549
  Differential Revision:	https://reviews.freebsd.org/D26395

Changes:
  head/bin/cp/utils.c
Comment 4 Katsuyuki Miyoshi 2020-09-12 11:50:30 UTC
(In reply to commit-hook from comment #3)
It's fine. Thanks.
Comment 5 Alan Somers freebsd_committer freebsd_triage 2020-09-19 18:00:27 UTC
Fixed by 365643.  The bug was never introduced to any stable branch.