Bug 7148

Summary: diff -r does not show removed (or new) directories
Product: Busybox Reporter: Paco SoberĂ³n <unratito>
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: major CC: busybox-cvs, rainer.canavan+busybox
Priority: P5    
Version: 1.33.x   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Host: Target:
Build:
Attachments: add directories to the directory listing if -r flag was set, but -N was not

Description Paco SoberĂ³n 2014-06-03 11:34:47 UTC
I caught this while working with MobaXterm, but managed to reproduce a simpler case in the Live BusyBox page (http://www.busybox.net/live_bbox/live_bbox.html):

/ # cd tmp/
/tmp # mkdir a
/tmp # mkdir b
/tmp # mkdir a/x
/tmp # mkdir a/y
/tmp # mkdir b/y
/tmp # diff -r a b
/tmp # 

Compared to the output in the latest CentOS, for example:

[root@localhost ~]# cd /tmp/
[root@localhost tmp]# mkdir a
[root@localhost tmp]# mkdir b
[root@localhost tmp]# mkdir a/x
[root@localhost tmp]# mkdir a/y
[root@localhost tmp]# mkdir b/y
[root@localhost tmp]# diff -r a b
Only in a: x
[root@localhost tmp]#
Comment 1 Dmitrey Salnikov 2015-07-04 18:35:23 UTC
works normal on 1.24
Comment 2 Dmitrey Salnikov 2015-07-04 18:43:09 UTC
(In reply to comment #1)
> works normal on 1.24

Oh.. now.. I was testing not busybox diff ;(
Comment 3 rainer.canavan+busybox 2020-01-14 18:51:11 UTC
This problem still exists in busybox 1.31.1
Comment 4 rainer.canavan+busybox 2020-01-14 18:56:38 UTC
The exit status is still set to "1" as it should be, so it's really only the message that is missing.
Comment 5 iom 2021-06-22 23:24:04 UTC
Created attachment 9016 [details]
add directories to the directory listing if -r flag was set, but -N was not

This patch just makes diff to follow diffutils behaviour.
I don't know if diff.c code can be optimized.