From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26122 invoked from network); 5 Oct 2022 22:17:45 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Oct 2022 22:17:45 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1665008265; b=MdswJwOEHOD+UgzDHCSXwwkZ3TpYIQXE/uwwAZ+YvV1s+3OFcTfIR2C3i5vrT5xi+W6C3WIX9R Q76Gw4KpMZnrPR8q3c98NwnOWIx+eBL38xRtjJLdsQ6VDPFPzVOa5WvXWlViy5vT7/iZ+55+ld LlBW/AkclpMzQh5yr2rHG3dEBMANWlHD39PJq2kY1q3dYh7Xo1UW0SBf0wAx8Rq8unKe2d58Zt pFWTvrhkgO1uxrH8iaqiSWp14bok32MpsJH15ney7Vc0+jp/jxQ3YVa58dIAKbhMAQCWGGTOyA Ept/zBmSRa13ZjIg9Xhz2gFi3KRI+S1KDlkBa7WHIX9VIQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1665008265; bh=LvRMdPo6qjT8kV+pm+OCJkdEnicsOTBFL1p8z/TmK5Y=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=JuWt9adhNFo1MYeD/4RiYQbaDdozmU9g9rqwNGsZXrX7iRo0uOMC9rioXPz4pzxSH+9A3YrzPR x4TnFtF6BQXGTQQwQ1A+JHIiGjyJ+jNtofh47mdtYp0CoyWPP93T0lDnhdmyf5DXaAsrJy7D/q m+RxlSNFMnbUOJAyW7XQ5smHs4Ld/xWzF1O7L0WH8c44yBytXgyGB5kCKj7qlkx24RofLUOdpk nU+20cTZwRfl/LNjEVzYD7FDpvDTViQ/UBoWsDzJwirgsFKo5GrZUj9vcQ3mBEH/ljrCG8MX5U DjDI0/VCcDjPb75LVRWuwHwXE2fFRHSCKGT++NI3FQJnkw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=xHfllB+6bhfJYr2bb/XAecwFgDmFCLuZJMozZAlm7V8=; b=Y/AdeCM5B8/AXHXYzVRL5Zr9e9 JmtgTp6bU+QuzBcjl/ovd9zEZSISqDNufn2sLQZI2LQh4AR/s/7jgq0g8CfCFFCpkay6298fK56PH y/fx4rcDzsj5kxFnUt3Xtm+Gleu0WvH9RRSvzzHxtJpbz5py0DzdbeiegMfsEVDCWf9S3DNgvEN1Q h8UbZwpLy36mHRTLh9JRXuZSb5wGAVTaKJbQYeGc8ZblLJYsqq+8lpwZF7JsROFR8MMNWU0+duLi5 JEfhr9rMbeeImGFl3Mo5POlWUNcgY38nTBhAOxTPDctxTme9P6ZbgYzMw9Xczi153DJHNba3IFrij mQc2P2eg==; Received: from authenticated user by zero.zsh.org with local id 1ogCi0-0001XS-Ln; Wed, 05 Oct 2022 22:17:44 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f44.google.com) smtp.remote-ip=209.85.218.44; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f44.google.com ([209.85.218.44]:33769) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ogCgx-0000pF-0W; Wed, 05 Oct 2022 22:16:40 +0000 Received: by mail-ej1-f44.google.com with SMTP id qn17so796271ejb.0 for ; Wed, 05 Oct 2022 15:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=xHfllB+6bhfJYr2bb/XAecwFgDmFCLuZJMozZAlm7V8=; b=NszgY58ow1+XGao7Vs2tMAoU4q67rQiHGaqwLIiKI7mEVJJZu5QmD2gwX7pkVrLYAm 4hzd+8QlgxZpaKakDcBaSLWknculrHy1alP33rkVzqM0BvqAPRtne+j/X/9DGvR7LEmg xDzwD/Y6WtUUqXhZTv9gkKaHiceITU3/NMWA/1NbSeFczqJa7gmU1kcVlle5LqNv4Imw BUSNZ653CUWj2jTGyU8ZQO8/rmIxcOhAz2PG7qJ/r+42zdzVPwt7fw2P/cjrYAQdC1Zn cixslks8gbYqFoLU4JTtmqR6ndGl308JW6vSK/KHeZSsHTNsOh/XQcOCNdeKZsjSZX4H BeMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xHfllB+6bhfJYr2bb/XAecwFgDmFCLuZJMozZAlm7V8=; b=jpgr/IoUQRShT9EDPaIVHcd2sr0I79z+OZ71cNr5EdofM73v7wJ6vwvsEyIGSSTmvV 1jGkrMtCpnTf1TXhXkgmr4Yd7o3Wihag0ZJWNSv6u3nRMJIjtBCykHDhUMSZKlO1qOyB bo7TUDqyUIIlvSnQo4m4Z1+YGHo4CfzBJGLt5cOW+jc4eBmimfXqTatruxISYLbAE9Sw 9T+PTs6WDvOYuyTEnJ4kwV/jAUMa6QVl9+zhtdVvFTxeQmbgt/80YuP7dChVXyxsax3z y6jxH20FggZ8kMOdS9eVIK8r/TXj83F97iOJvmI94WTujKjckreTYGFkAlblq3WsSyji /PFQ== X-Gm-Message-State: ACrzQf0GaTj8CsimxC594l2+u35aTEZWyy4wrPHtgom6Mk8bhal+MHvl kaTdWbxn3DnTEbk/878JbAvoEpBoQjWfiVdKNeEKMA== X-Google-Smtp-Source: AMsMyM72jnrAWYa4GL5t7P4qDCOI7pJ4VjLXBax//MUq4nmm5dyNYfq7tuRAI0R6mccf8C2A+F82j+PF9Fcn+WD6bMI= X-Received: by 2002:a17:906:58c7:b0:722:f4bf:cb75 with SMTP id e7-20020a17090658c700b00722f4bfcb75mr1423397ejs.450.1665008198501; Wed, 05 Oct 2022 15:16:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Wed, 5 Oct 2022 15:16:27 -0700 Message-ID: Subject: Re: Bug: Losing .zsh_history To: dominik.vogt@gmx.de, Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 28179 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, Oct 5, 2022 at 12:55 PM Dominik Vogt wrote: > > I wonder if this situation could be prevented by changing the code > that writes the history file at exit. Is truncating the file to > zero size part of the procedure? When I need to write a file in a > safe manner, the procedure normally looks like this: > > * Create file.new > * Rename file to file.old > * Rename file.new to file > (* Possibly sync filesystem) > * Erase file.old zsh is not going to sync the filesystem for you. Other than that, though, the default behavior should be close to what you just described, see the HIST_SAVE_BY_COPY option (which you should make sure has not been unset). You might also look at the setting of the HIST_FCNTL_LOCK option.