#2158 reopened defect

dup2 is broken

Reported by: Chris Johns Owned by: Chris Johns
Priority: normal Milestone: Indefinite
Component: fs Version: 4.11
Severity: normal Keywords: POSIX-Compliance
Cc: sebastian.huber@… Blocked By:

Description (last modified by Joel Sherrill)

The dup2 call is just the dup call and this is wrong. The switch in fcntl needs to know which call is dup and which is dup2.

The dup2 call is needed to implement redirection.

Attachments (1)

rtems-dup2-fix.diff (3.5 KB) - added by Chris Johns on Dec 3, 2013 at 5:16:36 PM.
Add dup2 support.

Download all attachments as: .zip

Change History (13)

Changed on Dec 3, 2013 at 5:16:36 PM by Chris Johns

Attachment: rtems-dup2-fix.diff added

Add dup2 support.

comment:1 Changed on Dec 3, 2013 at 5:16:54 PM by Chris Johns

Status: newassigned

comment:2 Changed on Dec 10, 2013 at 2:14:52 AM by Chris Johns

Resolution: fixed
Status: assignedclosed

comment:3 Changed on Dec 10, 2013 at 6:54:45 AM by Sebastian Huber

Resolution: fixed
Status: closedreopened, sebastian.huber@embedded-brains.de

comment:4 Changed on Dec 10, 2013 at 7:56:07 PM by Chris Johns

Good idea to link the test case to this PR. I have code to add which redirects stderr and stdout to a buffer.

comment:5 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:6 Changed on Mar 2, 2015 at 8:42:45 PM by Gedare Bloom


bump milestone

comment:7 Changed on Feb 12, 2016 at 7:46:07 PM by Joel Sherrill

Description: modified (diff)

I added this ticket to the potential GSoC project https://devel.rtems.org/wiki/Developer/Projects/Open/POSIXCompliance. Chris mentioned a test case. Where is it? It would be good to get that available.

comment:8 Changed on Jan 26, 2017 at 7:16:00 AM by Sebastian Huber


comment:9 Changed on Mar 23, 2017 at 1:03:28 AM by Chris Johns


The 4.11.2 milestone is closing.

comment:10 Changed on Apr 3, 2017 at 11:29:20 PM by Joel Sherrill

Keywords: POSIX-Compliance added

comment:11 Changed on Feb 7, 2018 at 11:19:52 PM by Chris Johns

Milestone: 4.11.3Indefinite

Requires funding to add a test case. The patch is applied.

comment:12 Changed on Apr 22, 2021 at 11:43:34 PM by Joel Sherrill

Support for dup2() was added in 2013.


Older coverage information indicates this code is probably fully covered. This should be confirmed on the master and at least architectures. Then this can be closed.

Note: See TracTickets for help on using tickets.