From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id b04852c0 for ; Tue, 30 Jul 2019 18:23:37 +0000 (UTC) Received: (qmail 19525 invoked by alias); 30 Jul 2019 18:23:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44598 Received: (qmail 10310 invoked by uid 1010); 30 Jul 2019 18:23:23 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25524. spamassassin: 3.4.2. Clear:RC:0(209.85.166.53):SA:0(-2.0/5.0):. Processed in 3.496885 secs); 30 Jul 2019 18:23:23 -0000 X-Envelope-From: roman.perepelitsa@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.53 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NcW/z4hj+S7v5fUTnhIlmV4ewsAzJdFkEqgNdc7+J2g=; b=UyxX41YNrzER4gvK77qbK64ArGoepJI2iXHQJTAJqF7rQ7OSWQ+ZZYWXbMfJnZD0/j HXPBieDEk2zB7ZeetbyYMwaM2OML6mkdxasPuPsDhmdIik+6GbuQ0LoDySqelpwM1lYE YWTNNCezLWvUkix13WnzYEhrm4WhE0Uj1ZBcMWbaebNaH89670hRRbSO8VXcMg7SwZiR t38218vhKzez/6HAT2spA93zom/mo+uyuFQqJ6CDdAjf2pxmQS4hOyNSf9p9H8Y83O3k H6cwPRgK7Rt28DedoGzXvMcbmnxTn+etJEcPvufvOH3oaHNGyFVAR780j9WWSxgapz+O TFgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NcW/z4hj+S7v5fUTnhIlmV4ewsAzJdFkEqgNdc7+J2g=; b=Ttsh3VWo+GQQaBGhQNbviL1ACaUnW1Eaid5UQE/XtgsvE0avLiHFiiMs1kE8d/UnbI thwQXqkhB0ATSzaLhKFCXhKRpCPQjyxdK4TitLSbpbYcHXE4cTgN+z29bOARFrFZMrWq BVdTl7ncH85el2oPNK4XQIiRB443CR59ua/fdd0Vl6eCSsVuTvmzLZC/MBPERnyGNWEu fNuQzgzmjJ0RrS9fJcnhHRNsIntWmiO0UAtii0OO5gY4dh0zUmCPX5ILGBP+fdmSgiZ8 JVXe3Qq4kOzgyQ8wlDxuZ5DGfRj4+cY7/IrURKMopT0XOK+6594J1rSUEqxP+UE+uQ5l xegg== X-Gm-Message-State: APjAAAW5VQAx4TlUwHOXaHIHcBug3rTR3VS59rrKhqHxePwwBj7vWTAm VIZrUgFKuRk4VbjnWqJA4o7U0Ap9qh8EZ37kcIBWL1QXbD/jjw== X-Google-Smtp-Source: APXvYqzA6Z5q47WjNxDul5ZuEwXoBQCTRVpKa4faTjU0ByYyt7saTRT5biuM9WD1MMEouZCk4x4tYDRCTMb+7gN3B18= X-Received: by 2002:a5d:9908:: with SMTP id x8mr56446632iol.304.1564510967889; Tue, 30 Jul 2019 11:22:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Roman Perepelitsa Date: Tue, 30 Jul 2019 20:22:36 +0200 Message-ID: Subject: =?UTF-8?Q?Re=3A_A_serious_bug_in_execution_=E2=80=93_where_to_debug=3F?= To: Sebastian Gniazdowski Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 30, 2019 at 8:16 PM Sebastian Gniazdowski wrote: > > On Tue, 30 Jul 2019 at 20:12, Roman Perepelitsa > wrote: > > > > On Tue, Jul 30, 2019 at 7:55 PM Sebastian Gniazdowski > > wrote: > > > Yes, implementation of plugin effects withdrawal (i.e. unloading) > > > bases on this. I saw that your initialization of the prompt is called > > > from precmd, where the shadowing isn't active. So (today) I've > > > implemented: on-demand wrapping of any function call with the > > > shadowing-enabling code, and then after a single call unwrapping. Thi= s > > > way I'm able to unload your plugin. > > > > When you unload plugins, you also remove temporary files and kill > > background daemons, right? > > > > Roman. > > No. I guess that the temp-files removal can be easily added =E2=80=93 by > shadowing mktemp call. I didn't think about killing of the background > processes. I guess this too can be added, but I suspect that most of > them will be invisible in $jobtexts, i.e. disowned, so it might get > hard. Thanks for the suggestions. How are you running the gitstatus > process in the plugin? Do you think it's possible to implement clean shutdown and reentrant initialization for a piece of code as blackbox? gitstatusd and p10k both have clean shutdown in their public APIs. It was quite difficult to implement. By using this API you release all resources and can initialize the plugins once again within the same shell. However, if you unset internal variables or close file descriptors, or fail to kill daemons, you are in undefined behavior land and all bets are off. Roman.