[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs pretest 28.0.90 is out
From: |
Eli Zaretskii |
Subject: |
Re: Emacs pretest 28.0.90 is out |
Date: |
Sat, 11 Dec 2021 13:23:59 +0200 |
> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sat, 11 Dec 2021 17:42:31 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > And in any case, even if you want not to go through a temporary file,
> > I'd prefer to edit the original recipe in sed1v2.inp instead of adding
> > a DOS-specific recipe, as the former is safer for changes on the
> > release branch.
>
> Thanks, I opted to implement this option, and it works well.
>
> I also implemented futimens (and based on that, utimensat), and fixed
> the rest of the issues you outlined above.
>
> If the following patch looks good to you, I will install it on
> emacs-28. Thanks.
A couple of minor gotchas below, and then you can install this.
> +int
> +fchmodat (int fd, const char *path, mode_t mode, int flags)
> +{
> + if (fd != AT_FDCWD)
> + {
> + if (strlen (dir_pathname) + strlen (path) + 1 >= MAXPATHLEN)
> + {
> + errno = ENAMETOOLONG;
> + return -1;
> + }
> + }
> +
> + return chmod (path, mode);
> +}
No support for AT_FDCWD here (by using dir_pathname)?
> +int
> +futimens (int fd, const struct timespec times[2])
> +{
> + struct tm *tm;
> + struct ftime ft;
> + time_t t;
> +
> + block_input ();
> + if (times[1].tv_sec == UTIME_NOW)
> + t = time (NULL);
> + else
> + t = times[1].tv_sec;
> +
> + tm = localtime (&t);
> + ft.ft_tsec = min (59, tm->tm_sec);
ft_sec is 0 to 29, in 2-sec units (as DOS has only 2-sec resolution in
file time stamps), so you need to scale it here.
> +int
> +utimensat (int dirfd, const char *pathname,
> + const struct timespec times[2], int flags)
> +{
> + int fd;
> + char fullname[MAXPATHLEN];
> +
> + if (dirfd != AT_FDCWD)
> + {
> + if (strlen (dir_pathname) + strlen (pathname) + 1 >= MAXPATHLEN)
> + {
> + errno = ENAMETOOLONG;
> + return -1;
> + }
> + sprintf (fullname, "%s/%s", dir_pathname, pathname);
> + pathname = fullname;
> + }
> +
> + /* Rely on a hack: dirfd in its current usage in Emacs is always
> + AT_FDCWD. */
This comment seems to be out of place, you need to move it higher up,
I believe.
> + fd = open (pathname, O_WRONLY);
> +
> + if (fd < 0)
> + return -1;
> +
> + return futimens (fd, times);
This leaks a file descriptor, since you open the file, but don't close
it.
Thanks.
- Re: Emacs pretest 28.0.90 is out, (continued)
- Re: Emacs pretest 28.0.90 is out, Eli Zaretskii, 2021/12/09
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/09
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/09
- Re: Emacs pretest 28.0.90 is out, Eli Zaretskii, 2021/12/10
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/10
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/10
- Re: Emacs pretest 28.0.90 is out, Eli Zaretskii, 2021/12/10
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/10
- Re: Emacs pretest 28.0.90 is out, Eli Zaretskii, 2021/12/11
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/11
- Re: Emacs pretest 28.0.90 is out,
Eli Zaretskii <=
- Re: Emacs pretest 28.0.90 is out, Po Lu, 2021/12/11
- Re: Emacs pretest 28.0.90 is out, Eli Zaretskii, 2021/12/06
Re: Emacs pretest 28.0.90 is out, David O'Toole, 2021/12/04
pretest installed (was: Emacs pretest 28.0.90 is out), andrés ramírez, 2021/12/08
MingGW: Bug in TeX input-method?, was: Re: Emacs pretest 28.0.90 is out, H. Dieter Wilhelm, 2021/12/12