[PR,libfortran/62768] Handle filenames with embedded nulls
diff mbox

Message ID alpine.BSF.2.02.1409171203330.89896@arjuna.pair.com
State New
Headers show

Commit Message

Hans-Peter Nilsson Sept. 17, 2014, 4:12 p.m. UTC
On Wed, 17 Sep 2014, Janne Blomqvist wrote:
> > /tmp/hpautotest-gcc1/gcc/libgfortran/io/inquire.c:97:41: error: 'gfc_unit' has no member named 'file'
> >      fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
> >                                          ^
> > /tmp/hpautotest-gcc1/gcc/libgfortran/io/inquire.c:97:50: error: 'gfc_unit' has no member named 'file_len'
> >      fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
> >                                                   ^
> > make[3]: *** [inquire.lo] Error 1
> >
> > brgds, H-P
>
> Oops, I forgot to update some parts in an #ifdef branch that isn't
> taken on my target. I'll try to find time to fix it later tonight. If
> you're in a hurry, just replace
>
> fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
>
> with
>
> cf_strcpy (iqp->name, iqp->name_len, u->filename);
>
> in inquire.c.

Thanks, build completes and I'll commit the following as obvious
if there are no regressions.  (The indentation change is
correct; lining up with the "else".  Note the closing brace.)

	* libgfortran/io/inquire.c (inquire_via_unit)
	[!HAVE_TTYNAME && !HAVE_TTYNAME_R && !__MINGW32__]: Adjust for
	last commit.

brgds, H-P

Comments

Hans-Peter Nilsson Sept. 17, 2014, 6:34 p.m. UTC | #1
On Wed, 17 Sep 2014, Hans-Peter Nilsson wrote:
> On Wed, 17 Sep 2014, Janne Blomqvist wrote:
> > Oops, I forgot to update some parts in an #ifdef branch that isn't
> > taken on my target. I'll try to find time to fix it later tonight. If
> > you're in a hurry, just replace
> >
> > fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
> >
> > with
> >
> > cf_strcpy (iqp->name, iqp->name_len, u->filename);
> >
> > in inquire.c.
>
> Thanks, build completes and I'll commit the following as obvious
> if there are no regressions.

Since there are 25 related regressions, not committed.
There must be something else amiss too.

(Maybe you can find it on your platform by artificially
disabling HAVE_TTYNAME && HAVE_TTYNAME_R.)

+gfortran.sum gfortran.dg/f2003_inquire_1.f03
+gfortran.sum gfortran.dg/inquire.f90
+gfortran.sum gfortran.dg/inquire_13.f90
+gfortran.sum gfortran.dg/inquire_15.f90
+gfortran.sum gfortran.dg/inquire_16.f90
+gfortran.sum gfortran.dg/inquire_6.f90
+gfortran.sum gfortran.dg/inquire_7.f90
+gfortran.sum gfortran.dg/inquire_9.f90
+gfortran.sum gfortran.dg/inquire_size.f90
+gfortran.sum gfortran.dg/large_unit_1.f90
+gfortran.sum gfortran.dg/large_unit_2.f90
+gfortran.sum gfortran.dg/negative_unit.f
+gfortran.sum gfortran.dg/negative_unit_int8.f
+gfortran.sum gfortran.dg/open_negative_unit_1.f90
+gfortran.sum gfortran.dg/pr20950.f
+gfortran.sum gfortran.dg/streamio_10.f90
+gfortran.sum gfortran.dg/streamio_16.f90
+gfortran.sum gfortran.dg/streamio_3.f90
+gfortran.sum gfortran.dg/streamio_8.f90
+gfortran.sum gfortran.dg/unf_io_convert_4.f90
+gfortran.sum gfortran.fortran-torture/execute/inquire_1.f90
+gfortran.sum gfortran.fortran-torture/execute/inquire_2.f90
+gfortran.sum gfortran.fortran-torture/execute/inquire_3.f90
+gfortran.sum gfortran.fortran-torture/execute/inquire_4.f90
+gfortran.sum gfortran.fortran-torture/execute/inquire_5.f90

brgds, H-P
Hans-Peter Nilsson Sept. 17, 2014, 8:36 p.m. UTC | #2
On Wed, 17 Sep 2014, Hans-Peter Nilsson wrote:
> On Wed, 17 Sep 2014, Hans-Peter Nilsson wrote:
> > On Wed, 17 Sep 2014, Janne Blomqvist wrote:
> > > Oops, I forgot to update some parts in an #ifdef branch that isn't
> > > taken on my target. I'll try to find time to fix it later tonight. If
> > > you're in a hurry, just replace
> > >
> > > fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
> > >
> > > with
> > >
> > > cf_strcpy (iqp->name, iqp->name_len, u->filename);
> > >
> > > in inquire.c.
> >
> > Thanks, build completes and I'll commit the following as obvious
> > if there are no regressions.
>
> Since there are 25 related regressions, not committed.
> There must be something else amiss too.

On the other hand, the tree *is* broken for some ports; I'd
prefer regressions to that.  So, unless you're onto this, how do
you feel about me committing the posted patch and opening a PR
for the regressions?

brgds, H-P

Patch
diff mbox

Index: libgfortran/io/inquire.c
===================================================================
--- libgfortran/io/inquire.c	(revision 215321)
+++ libgfortran/io/inquire.c	(working copy)
@@ -94,7 +94,7 @@  inquire_via_unit (st_parameter_inquire *
       else
 	fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
 #else
-    fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
+      cf_fstrcpy (iqp->name, iqp->name_len, u->filename);
 #endif
     }