From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Emacs pretest 28.0.90 is out Date: Sat, 11 Dec 2021 13:23:59 +0200 Message-ID: <83fsqzqt9s.fsf@gnu.org> References: <831r2mug6n.fsf@gnu.org> <83zgpat0di.fsf@gnu.org> <87v8zy9c4o.fsf@yahoo.com> <87r1am9bsz.fsf@yahoo.com> <83wnkesz7r.fsf@gnu.org> <87mtl9apcx.fsf@yahoo.com> <83v8zxucaz.fsf@gnu.org> <87ilvxao13.fsf@yahoo.com> <83r1alub0m.fsf@gnu.org> <83pmq5ua9p.fsf@gnu.org> <83o85pu9u0.fsf@gnu.org> <83mtl9u9c8.fsf@gnu.org> <87a6h99uk5.fsf@yahoo.com> <875yrx9tlo.fsf@yahoo.com> <831r2kua9o.fsf@gnu.org> <877dcc6bw7.fsf@yahoo.com> <87wnkc4lrj.fsf@yahoo.com> <83lf0ssfho.fsf@gnu.org> <87o85o3q7h.fsf@yahoo.com> <83sfuzr2b0.fsf@gnu.org> <87r1aj32bc.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12244"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 11 12:24:46 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mw0Uf-0002zC-QS for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 12:24:46 +0100 Original-Received: from localhost ([::1]:37486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mw0Ue-0005Ct-BV for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 06:24:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw0U8-0004YQ-J6 for emacs-devel@gnu.org; Sat, 11 Dec 2021 06:24:12 -0500 Original-Received: from [2001:470:142:3::e] (port=57196 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw0U8-000778-9n; Sat, 11 Dec 2021 06:24:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zRcqpRLxNzFl3S75b7GcFypmm7tTbNQcm7nCQnaesyU=; b=ognknwC1TUhx apJAgMDkD8Zf7UfJL9lfuVeq9HUz7M/H1mFggbwc5ebP0fZFZP0bX2h/VXt+YpxgqI/vmHuCsKhfz z8Vd24R4rro+qIoatyHulQeQrNaugxnf9Wv9tPvC+YXfgwrRKg9MtsUvukP+nN2GKW0H3XJ0XijLA +0hZ/+arJMLIqOlYSthF6ST6gy5frhccPW8qKpFH0v2ShgVIDHDO9aaMTkysJ0gzmp30NFCX8lSLy St1nXf+LWAY1baO0wR8RK6tC/v9Y8W0aZB2YR7DOP6XHgMDCoFua4DcU4kOc4LjUSxT6vpZdRFy/b qPV4ulc8c0nJ1DnHaBzdtw==; Original-Received: from [87.69.77.57] (port=1808 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw0U8-0007MV-31; Sat, 11 Dec 2021 06:24:12 -0500 In-Reply-To: <87r1aj32bc.fsf@yahoo.com> (message from Po Lu on Sat, 11 Dec 2021 17:42:31 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281672 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Sat, 11 Dec 2021 17:42:31 +0800 > > Eli Zaretskii 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.