delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/07/18:20:59

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 467MKxVw3870511
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=eenoT3Lq
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F702385DDF8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1720390857;
bh=cFapgG6qPcLGvqbiii90tRRuN7DRQWj3Ec2i67siDNU=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=eenoT3Lqa8lUmDV/2jSqr95hn+fgNgZZlTBRhXUje7cvh1omdU2Q6ZXIhFVmyQwM2
wZnOjP61IenI5wPRf+oG9zndHL4TPS6IUSv0e6Jh51SZwFrYrJmhf2B6BdebDO9sWB
40tjs5w3d6g50+q5QUFDOKcsPGnaGap6tqtPzZww=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C8623858CDA
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C8623858CDA
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720390805; cv=none;
b=a2XQfyo3KTLQlfv3Dmsbf+pSlaB7nqTEXXKYyZQ5o1ZTO+UucEdL3IJSuK/icQiDTlJNi5oWX7LecEGVuExgvt1lYXDIR/l39CuRMfThSZe7QubFhLeMM+Z/EF2128n69sCx4NT9HQ5fV1IavGvn580Nm5dmc+HyqVHvKo8MU4M=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1720390805; c=relaxed/simple;
bh=VHL6pN+oid+dbz3DrWeT515EpajsFv9N3mdwC7mYBJI=;
h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version;
b=McSPy6XFinZmNiQ9GovVptZYZR6R+L5qHMeRQ8t3Ix7kYkU/MDO8jWXKrAREKStGbhcjab7AkYPgVuwX05YNl1cBhuMIwGedV/2531MnH64inYZLzvqS7V3WRsbrjzhrIIM4nul+hbrU7jvvs2FQu82i5+L05fGO8zyszd6RBpg=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Yandex-Fwd: 1
Date: Mon, 8 Jul 2024 01:19:53 +0300
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <1658029694.20240708011953@yandex.ru>
To: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>, cygwin AT cygwin DOT com
Subject: Re: crontab: no changes made to crontab
In-Reply-To: <a93617f2-0f4a-47da-b74e-1de4798c2a6d@SystematicSW.ab.ca>
References: <1688028774 DOT 20240706135038 AT yandex DOT ru>
<a93617f2-0f4a-47da-b74e-1de4798c2a6d AT SystematicSW DOT ab DOT ca>
MIME-Version: 1.0
X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT,
NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP,
XM_LIGHT_HEAVY autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Andrey Repin via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Andrey Repin <anrdaemon AT yandex DOT ru>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 467MKxVw3870511

Greetings, Brian Inglis via Cygwin!

> On 2024-07-06 04:50, Andrey Repin via Cygwin wrote:
>> I'm trying to install a new cron job, and the thing fails claiming that it
>> didn't see the edits I made to the file.

>>>> # echo "USER=$USER" | crontab -
>>>>
>>>> # crontab -l
>>>> # DO NOT EDIT THIS FILE - edit the master and reinstall.
>>>> # (- installed on Sat Jul  6 13:35:43 2024)
>>>> # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
>>>> USER=anrdaemon
>>>>
>>>> # crontab -e
>>>> ### do some edits…
>>>> crontab: no changes made to crontab

> What is your editor, how is it configured, how is it invoked, and how are
> VISUAL and EDITOR defined?

> Most commands that use an editor for some commands effectively invoke ${VISUAL:-${EDITOR:-vi}}.

My $EDITOR is a small wrapper script launching Far manager in editor mode.

>> cygstart "--directory=$( dirname "$1" )" --shownormal --wait -- "C:\\Programs\\Far3\\Far.exe" -i -co -e0:0 "$( cygpath -alw "${1:-.}" 2> /dev/null )"

> Your editor also has to behave as if it updates the temporary filename it is invoked with, as from:

>         $ mktemp --tmpdir crontab.XXXXXXXXXX

> for example /tmp/crontab.??????????, save changes into that file, and leave
> it changed when exiting, and other than nano's own /tmp/nano.?????? files, I see no special handling.

> The source has the following note:

>         https://github.com/vixie/cron/blob/master/crontab.c#L389

> which assumes that editors rewrite original files rather than
> renaming/unlinking because that allows security issues, so it compares the
> fstat mtime to the saved value to detect changes.

But that has a potential of losing the file contents.

>> Piping a new file to the crontab works, but that's "slightly" cumbersome.
>> What is it missing why it does not want to just work?
>> -- Few moments later… ---
>> It seems crontab dislikes safe file writes.

> What do you mean by safe file writes?

Hardlink original to temp. name, write to a new file, rename to original,
delete temp. name only if write and rename was successful.
This is a core function in Far's builtin editor and is not configurable.

>>>> $ stat x > 1; nano x; stat x > 2; diff -u0 1 2

>>>> $ stat x > 1; $EDITOR x; stat x > 2; diff -u0 1 2

> What do these show?

That nano rewrites original, where Far does not.

> If you are using `nano`, that should work, as it is used in almost every
> example from RaspberryPi, and someone would have complained!
> Unless the Cygwin package config differs from the Debian config, and it does
> not appear to significantly.

Naay… nano works. Running `EDITOR=nano crontab -e` works around the issue.

>> Is there a way around it that does not involve replacing crontab tool with my
>> own script that has no such issue?

> See above to fix the issue, or use:

>         $ $VISUAL $HOME/$USER.crontab
>         $ crontab $HOME/$USER.crontab
>         $ crontab -l

Figured as much, given the code comment you mentioned above.


-- 
With best regards,
Andrey Repin
Monday, July 8, 2024 01:08:52

Sorry for my terrible english...

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019