GNU bug report logs - #70473
[PATCH] tests: fix stdin tests

Previous Next

Package: diffutils;

Reported by: Tanmay <tanmaynpatil105 <at> gmail.com>

Date: Fri, 19 Apr 2024 12:11:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

To reply to this bug, email your comments to 70473 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#70473; Package diffutils. (Fri, 19 Apr 2024 12:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tanmay <tanmaynpatil105 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Fri, 19 Apr 2024 12:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tanmay <tanmaynpatil105 <at> gmail.com>
To: bug-diffutils <at> gnu.org
Subject: [PATCH] tests: fix stdin tests
Date: Fri, 19 Apr 2024 17:37:04 +0530
[Message part 1 (text/plain, inline)]
Hi,

I noticed that in the tests/stdin directory, we were taking input directly
from the 'd' directory, which seems incorrect.

tests/stdin:31 diff -u - a <d >out 2>err || fail=1

I'm not sure how the tests were working with input directly from the 'd'
directory. I'm including a patch which fixes it.

Thanks,
Tanmay

From 021148712cb01efb954e9c1a6961b2df9cdfcf04 Mon Sep 17 00:00:00 2001
From: Tanmay Patil <tanmaynpatil105 <at> gmail.com>
Date: Fri, 19 Apr 2024 17:20:39 +0530
Subject: [PATCH] tests: fix stdin tests

Signed-off-by: Tanmay Patil <tanmaynpatil105 <at> gmail.com>
---
 tests/stdin | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/stdin b/tests/stdin
index 0fd9e7e..dda076b 100755
--- a/tests/stdin
+++ b/tests/stdin
@@ -24,7 +24,7 @@ compare /dev/null err || fail=1
 mkdir d || framework_failure_
 echo a >d/a || framework_failure_

-diff -u - a <d >out 2>err || fail=1
+diff -u - a <d/a >out 2>err || fail=1
 compare /dev/null out || fail=1
 compare /dev/null err || fail=1

-- 
2.40.1
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Fri, 19 Apr 2024 15:53:04 GMT) Full text and rfc822 format available.

Notification sent to Tanmay <tanmaynpatil105 <at> gmail.com>:
bug acknowledged by developer. (Fri, 19 Apr 2024 15:53:04 GMT) Full text and rfc822 format available.

Message #10 received at 70473-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Tanmay <tanmaynpatil105 <at> gmail.com>
Cc: 70473-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#70473: [PATCH] tests: fix stdin tests
Date: Fri, 19 Apr 2024 08:52:12 -0700
On 2024-04-19 05:07, Tanmay wrote:
> I noticed that in the tests/stdin directory, we were taking input directly
> from the 'd' directory, which seems incorrect.
> 
> tests/stdin:31 diff -u - a <d >out 2>err || fail=1

I don't see a bug there. In general 'diff DIRECTORY FILE' acts like 
'diff DIRECTORY/FILE FILE'; here 'diff - a <d' acts like 'diff d/a a'.




Information forwarded to bug-diffutils <at> gnu.org:
bug#70473; Package diffutils. (Fri, 19 Apr 2024 18:30:03 GMT) Full text and rfc822 format available.

Message #13 received at 70473 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Tanmay <tanmaynpatil105 <at> gmail.com>
Cc: 70473 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#70473: [PATCH] tests: fix stdin tests
Date: Fri, 19 Apr 2024 11:28:54 -0700
On 4/19/24 11:17, Tanmay wrote:
> I've grown more curious about how this feature is implemented to handle 
> stdin.

Oh, that's one big advantage of free software: you can read the source 
code, and change it if it doesn't meet your needs. GNU diff implements 
this feature by using openat. See:

https://git.savannah.gnu.org/cgit/diffutils.git/tree/src/diff.c#n1541




Information forwarded to bug-diffutils <at> gnu.org:
bug#70473; Package diffutils. (Fri, 19 Apr 2024 23:06:43 GMT) Full text and rfc822 format available.

Message #16 received at 70473-done <at> debbugs.gnu.org (full text, mbox):

From: Tanmay <tanmaynpatil105 <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 70473-done <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#70473: [PATCH] tests: fix stdin tests
Date: Fri, 19 Apr 2024 23:47:42 +0530
[Message part 1 (text/plain, inline)]
Hi,

Thanks for replying!

I was using an older version (3.8) of diffutils on my machine, and I
believe this feature was introduced recently. So, I thought it might be a
bug. Now, I've grown more curious about how this feature is implemented to
handle stdin. Implementing it without stdin seems fairly straightforward.

Looking forward to your response.

Thanks,
Tanmay

On Fri, 19 Apr 2024 at 21:22, Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> On 2024-04-19 05:07, Tanmay wrote:
> > I noticed that in the tests/stdin directory, we were taking input
> directly
> > from the 'd' directory, which seems incorrect.
> >
> > tests/stdin:31 diff -u - a <d >out 2>err || fail=1
>
> I don't see a bug there. In general 'diff DIRECTORY FILE' acts like
> 'diff DIRECTORY/FILE FILE'; here 'diff - a <d' acts like 'diff d/a a'.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#70473; Package diffutils. (Sat, 20 Apr 2024 04:42:03 GMT) Full text and rfc822 format available.

Message #19 received at 70473 <at> debbugs.gnu.org (full text, mbox):

From: Tanmay <tanmaynpatil105 <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 70473 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#70473: [PATCH] tests: fix stdin tests
Date: Sat, 20 Apr 2024 10:10:44 +0530
[Message part 1 (text/plain, inline)]
>
> Oh, that's one big advantage of free software: you can read the source
> code, and change it if it doesn't meet your needs.
>
Indeed, that's the reason we all love Free Software.

Thank you very much for directing me to that piece of code. I was
struggling a bit to understand it.

Thanks,
Tanmay

On Fri, 19 Apr 2024 at 23:58, Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> On 4/19/24 11:17, Tanmay wrote:
> > I've grown more curious about how this feature is implemented to handle
> > stdin.
>
> Oh, that's one big advantage of free software: you can read the source
> code, and change it if it doesn't meet your needs. GNU diff implements
> this feature by using openat. See:
>
> https://git.savannah.gnu.org/cgit/diffutils.git/tree/src/diff.c#n1541
>
[Message part 2 (text/html, inline)]

This bug report was last modified 16 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.