[PATCH] iconv: iconv -o should not create executable files (bug 33164)

Florian Weimer fweimer@redhat.com
Thu Jul 17 12:32:51 GMT 2025


* H. J. Lu:

> On Wed, Jul 16, 2025 at 3:17 PM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu:
>>
>> > There are other open with 0777:
>> >
>> > iconv/iconv_prog.c:  output_fd = open64 (output_file, O_WRONLY |
>> > O_CREAT | O_TRUNC, 0777);
>> > iconv/iconv_prog.c:      output_fd = open64 (output_file, O_WRONLY |
>> > O_CREAT | O_EXCL, 0777);
>>
>> (fixed by the patch)
>>
>> > io/tst-fchmodat.c:      printf ("openat created mode %04o, not
>> > 0644\n", (st1.st_mode & 0777));
>> > io/tst-ftw-lnk.c:  if (open ("link2-tgt", O_RDWR|O_CREAT, 0777) < 0)
>> > stdio-common/tst-setvbuf2.c:    td->fd = xopen (td->fname, O_WRONLY, 0777);
>> > stdio-common/tst-setvbuf2.c:    td->fd = xopen (td->fname, O_RDONLY, 0777);
>> > stdio-common/tst-setvbuf2.c:      fd = xopen (fname,
>> > O_WRONLY|O_CREAT|O_TRUNC, 0777);
>> > support/shell-container.c:   new_stdin = open (argv[i + 1],
>> > O_WRONLY|O_CREAT|O_TRUNC, 0777);
>> > support/shell-container.c:   new_stdout = open (argv[i + 1],
>> > O_WRONLY|O_CREAT|O_TRUNC, 0777);
>> > support/shell-container.c:   new_stdout = open (argv[i + 1],
>> > O_WRONLY|O_CREAT|O_APPEND, 0777);
>> > support/shell-container.c:   new_stderr = open (argv[i + 1],
>> > O_WRONLY|O_CREAT|O_TRUNC, 0777);
>> >
>> > Should any of them also be changed to 0666?
>>
>> These are all test files.  I think they should be fixed in a separate
>> commit.  No bug in Bugzilla needed for that, I think.
>>
>
> I think they should be fixed in a single commit or open a separate bug
> to track the test bug.

I filed:

  Some tests create files using mode 0777
  <https://sourceware.org/bugzilla/show_bug.cgi?id=33171>

Thanks,
Florian



More information about the Libc-alpha mailing list