Re: Documentation update for relocatable-lib{,-lgpl}

2017-04-04 Thread Ben Pfaff
On Tue, Apr 04, 2017 at 01:07:58AM +0100, Reuben Thomas wrote:
> [Ben: Ccing you on Bruno Haible's advice]
> 
> Having gone through the changes I needed to make to my sources to use the
> relocatable-lib-lgpl module, here's a list of things I think should be
> documented in doc/relocatable-maint.texi. If they're agreed to be correct,
> I'll prepare a documentation patch.

I think that Bruno is really the expert here.  I helped out with
"relocatable" to a significant degree, but I don't have any expertise
with libraries.  If Bruno approves, then I second it.



Re: relocatable given GPL boilerplate despite asking for relocatable-lib-lgpl

2017-04-04 Thread Bruno Haible
> Do you have any objection to updating the "default" licenses on the files
> to GPL so that there's no discrepancy with the gnulib documentation?

No objection. Fine with me.

Bruno



Re: futimens() for WIN32/MinGW

2017-04-04 Thread Bruno Haible
Hi Tim,

> gnulib has no support for WIN32 futimens resp. the gnulib implementation
> returns a 'not implemented' error.
> 
> So today I wrote a surrogate for it, which works for me on MinGW.
> 
> Since I am not sure where to add it (futimens.c or utimens.c) and if
> there are caveats, I ask you to add it where appropriate.
> 
> #ifdef _WIN32
> #include 
> 
> int futimens(int fd, const struct timespec times[2])
> {
>   FILETIME mt, at;
>   LONGLONG ll;
> 
>   // convert time_t to FILETIME
>   ll = Int32x32To64(times[0].tv_sec, 1000) + 1164447360;
>   at.dwLowDateTime = (DWORD) ll;
>   at.dwHighDateTime = ll >> 32;
> 
>   ll = Int32x32To64(times[1].tv_sec, 1000) + 1164447360;
>   mt.dwLowDateTime = (DWORD) ll;
>   mt.dwHighDateTime = ll >> 32;
> 
>   BOOL success = SetFileTime(
>   (HANDLE) _get_osfhandle (fd),
>   ,  // creation
>   ,  // last access
>   ); // last modification
> 
>   return success ? 0 : -1;
> }
> #endif

This is a good start, indeed.

When integrating such a code in gnulib, one needs to check also
whether the existing tests (of this module and related modules)
or can be adapted. So the next practical step is to run
  ./gnulib-tool --create-testdir --with-tests --single-configure utimens 
futimens ...

You will then notice:
- There is a link error due to --single-configure and strerror_r.
- The logic in nap.h is buggy: it calls nanosleep with a negative
  delay argument. And it expects Unix behaviour that is not met
  by Windows.
- Not only utimens.c needs to be adjusted, but also utimecmp.c.
- st_mtime come out 2 hours higher than expected (for me). Obviously
  some timezone issue.
- And probably more...

I'm trying to get these sorted out, one by one.

Bruno



Re: relocatable given GPL boilerplate despite asking for relocatable-lib-lgpl

2017-04-04 Thread Reuben Thomas
On 4 April 2017 at 10:21, Bruno Haible  wrote:

> Reuben Thomas asks:
> > > This is because there are alternative instructions for using these
> files
> > > without gnulib-tool. (Although I don't know whether anyone still goes
> > > with these lengthy instructions; gnulib-tool is quite accepted
> nowadays.)
> >
> >
> > ​Where are these instructions?
>
> They are in https://lists.gnu.org/archive/html/bug-gnulib/2003-03/
> msg00020.html
> (from 2003). The 'relocatable-*' modules were added to gnulib only later,
> on
> 2007-03-01.
>

​OK, so they're not something I would need to remove from gnulib.

Do you have any objection to updating the "default" licenses on the files
to GPL so that there's no discrepancy with the gnulib documentation?

-- 
http://rrt.sc3d.org


futimens() for WIN32/MinGW

2017-04-04 Thread Tim Rühsen
Hi,

gnulib has no support for WIN32 futimens resp. the gnulib implementation
returns a 'not implemented' error.

So today I wrote a surrogate for it, which works for me on MinGW.

Since I am not sure where to add it (futimens.c or utimens.c) and if
there are caveats, I ask you to add it where appropriate.

#ifdef _WIN32
#include 

int futimens(int fd, const struct timespec times[2])
{
FILETIME mt, at;
LONGLONG ll;

// convert time_t to FILETIME
ll = Int32x32To64(times[0].tv_sec, 1000) + 1164447360;
at.dwLowDateTime = (DWORD) ll;
at.dwHighDateTime = ll >> 32;

ll = Int32x32To64(times[1].tv_sec, 1000) + 1164447360;
mt.dwLowDateTime = (DWORD) ll;
mt.dwHighDateTime = ll >> 32;

BOOL success = SetFileTime(
(HANDLE) _get_osfhandle (fd),
,  // creation
,  // last access
); // last modification

return success ? 0 : -1;
}
#endif


Regards, Tim



signature.asc
Description: OpenPGP digital signature