Bug 249248 - cp: /dev/null: Invalid argument
Summary: cp: /dev/null: Invalid argument
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Alan Somers
URL: https://reviews.freebsd.org/D26395
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-09-11 09:28 UTC by Katsuyuki Miyoshi
Modified: 2020-09-19 18:00 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 2020-09-11 20:23:22 UTC
Fix is in code review
Comment 3 commit-hook freebsd_committer 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 2020-09-19 18:00:27 UTC
Fixed by 365643.  The bug was never introduced to any stable branch.