This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi Siddhesh,
Firstly, sorry about that I forget fixing the last space issue. Maybe
I was very tried when it was very late in the night.
Now the attachment "file_flags.diff" is the latest change which fix
the issue you mentioned.
The "test_flag.c" is the test codes to check the flag value.
The "test_buf.c" is the test codes to test if the setbuf of libc works well.
The following are the tests I did:
1. Run the test_flag.c on 32-bits and 64-bits platform, the output is "Equal".
It means (_IO_UNBUFFERED | _IO_LINE_BUF) has the same value of
(_IO_UNBUFFERED + _IO_LINE_BUF);
2. After update the glibc, gdb the test_buf.c to check if the setbuf
works well like before.
Because i am using the glibc-2.19 on my linux, so I apply my patch
to glibc-2.19, build and replace the original one. ( I am afraid my
computer become brick:))
Then gdb the binary of test_buf.c to check if the setbuf works
well like before.
Breakpoint 1, main () at test_buf.c:23
23 {
(gdb) n
26 printf("Before no-buffer.");
(gdb)
27 printf("Output now.\n");
(gdb)
Before no-buffer.Output now.
29 setbuf(stdout, NULL);
(gdb)
30 printf("No buffer now.");
(gdb)
No buffer now.32 setvbuf(stdout, buffer, _IOLBF, sizeof(buffer));
(gdb)
33 printf("Restore linebuf.");
(gdb)
34 printf("Output now.\n");
(gdb)
Restore linebuf.Output now.
36 return 0;
The output is the right behavior we expect.
3. I doesn't execute the "make check". Because it will hang without my
patch. So I could not do "make check" with my patch.
I don't know if there already is one bug in the current glibc codes.
It stop the following step for about 2 hours, so I have to cancel it.
scripts/evaluate-test.sh c++-types-check $? false false >
/home/fgao/works/my_git_codes/glibc-build/c++-types-check.test-result
AWK='gawk' scripts/check-local-headers.sh \
"/usr/include" "/home/fgao/works/my_git_codes/glibc-build/"
> /home/fgao/works/my_git_codes/glibc-build/check-local-headers.out; \
scripts/evaluate-test.sh check-local-headers $? false false >
/home/fgao/works/my_git_codes/glibc-build/check-local-headers.test-result
That's why I did not execute the "make check" with my change.
On Wed, Jul 8, 2015 at 12:28 AM, Siddhesh Poyarekar <siddhesh@redhat.com> wrote:
> On Wed, Jul 08, 2015 at 12:02:38AM +0800, Feng Gao wrote:
>> About the tests, I did the following cases:
>> 1. Write test codes to check if the (_IO_LINE_BUF|_IO_UNBUFFERED)
>> equals (_IO_LINE_BUF+_IO_UNBUFFERED);
>> 2. Update the glibc to check if it works like before.
>
> Thanks, it looks like you missed fixing spacing in the last instance
> (quoted below). Also, run 'make check' before and after the patch to
> make sure that there are no regressions due to this change. Updating
> glibc is a brave thing to do - if it breaks, your box is a brick that
> only a rescue disk can get back :)
>
> Please post an updated patch and also let me know the results of your
> test.
>
> Thanks,
> Siddhesh
>
>> @@ -477,7 +477,7 @@ _IO_wfile_overflow (_IO_FILE *f, wint_t wch)
>> f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
>>
>> f->_flags |= _IO_CURRENTLY_PUTTING;
>> - if (f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
>> + if (f->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
>> f->_wide_data->_IO_write_end = f->_wide_data->_IO_write_ptr;
>> }
>> if (wch == WEOF)
>
Attachment:
file_flags.diff
Description: Text document
/*
* =====================================================================================
*
* Filename: test.c
*
* Description:
*
* Version: 1.0
* Created: 07/07/2015 11:14:49 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
#define _IO_UNBUFFERED 2
#define _IO_LINE_BUF 0x200
int main(void)
{
if ((_IO_UNBUFFERED + _IO_LINE_BUF) == (_IO_UNBUFFERED | _IO_LINE_BUF)) {
printf("Equal\n");
} else {
printf("Not equal\n");
}
return 0;
}
/*
* =====================================================================================
*
* Filename: test_buf.c
*
* Description:
*
* Version: 1.0
* Created: 07/08/2015 10:43:01 AM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
char buffer[256];
printf("Before no-buffer.");
printf("Output now.\n");
setbuf(stdout, NULL);
printf("No buffer now.");
setvbuf(stdout, buffer, _IOLBF, sizeof(buffer));
printf("Restore linebuf.");
printf("Output now.\n");
return 0;
}
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |