From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#41000: Fwd: bug#41000: 28.0.50; Package file(.el) is 0 bytes after downloading Date: Tue, 24 Aug 2021 16:29:18 +0200 Message-ID: References: <87mu6o22su.fsf@stefankangas.se> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15340"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Compro Prasad , Lars Ingebrigtsen To: 41000@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 24 16:42:15 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1mIXcz-0003gi-KG for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Aug 2021 16:42:13 +0200 Original-Received: from localhost ([::1]:45350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIXcy-0006Ce-I4 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Aug 2021 10:42:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIXRD-0002WO-25 for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 10:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIXRC-0000h9-Pq for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 10:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mIXRC-0002nw-LL for bug-gnu-emacs@gnu.org; Tue, 24 Aug 2021 10:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Aug 2021 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41000 X-GNU-PR-Package: emacs Original-Received: via spool by 41000-submit@debbugs.gnu.org id=B41000.162981537910726 (code B ref 41000); Tue, 24 Aug 2021 14:30:02 +0000 Original-Received: (at 41000) by debbugs.gnu.org; 24 Aug 2021 14:29:39 +0000 Original-Received: from localhost ([127.0.0.1]:44955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIXQo-0002mw-RY for submit@debbugs.gnu.org; Tue, 24 Aug 2021 10:29:39 -0400 Original-Received: from mail-pl1-f179.google.com ([209.85.214.179]:37536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIXQm-0002mi-Rw for 41000@debbugs.gnu.org; Tue, 24 Aug 2021 10:29:37 -0400 Original-Received: by mail-pl1-f179.google.com with SMTP id q3so516280plx.4 for <41000@debbugs.gnu.org>; Tue, 24 Aug 2021 07:29:36 -0700 (PDT) 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=sQUNMm+mi1s4eix8w4/FHlGCFpvPQaoJHwa1wu2EzOo=; b=P0Bk3BPdfZ9wJhgVPvcGIc/5thDhWu5ZLQQLcCFqlmXiCVQ6sKBsC6z8vCWusbo17g gYKCWU8lGnJtj5hV4BFPiNgeYUzhwxD2t3vVi2/PiyXqIZkRPYefQDfSy9wOI/H71I+2 QrY5cakwmG2gALh3LaCWcvOEPem/dIfedoOWYF9MJnoplaWyDVhZ2bn9MbBcOd3OQkqv 82iRsvwYcqt6b+cIR3cS2mkubbI0ApIjt5r70vLnFeAMcSqDk8UTxORUGSe7PwIXQmR8 5Vlupo/OzIDrr0jFqwnhUH4o7UlSdW6ULPkjYBbblPAkqVq0TiAGXUODRtbxr6DVWhGP EisA== X-Gm-Message-State: AOAM532wkf3QozwCXQVxZ8kai93UPQp/tswcwv556DhILxMrnQnbAtFf Uv0Eyn6lz3Mmj2LQuai9qzrkZRNoiTJ/kCe/A5BUS4I3 X-Google-Smtp-Source: ABdhPJxraQ+1Vsrs9PnUNozB97rLqqzSsqPz5nT+qL7V5T3acGSlqLpW+gSRZJIBtVsXqQW0URLpQmcOnojN8Yxe+HY= X-Received: by 2002:a17:90a:c89:: with SMTP id v9mr4855931pja.175.1629815369896; Tue, 24 Aug 2021 07:29:29 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212545 Archived-At: It seems like the below was sent to me in private, without using "Reply to all" so it never reached the bug tracker. I am therefore forwarding the full message here. ---------- Forwarded message --------- Fr=C3=A5n: Compro Prasad Date: m=C3=A5n 11 maj 2020 kl 09:00 Subject: Re: bug#41000: 28.0.50; Package file(.el) is 0 bytes after downloa= ding To: Stefan Kangas On Sat, May 9, 2020 at 12:04 AM Stefan Kangas wrote: > > Compro Prasad writes: > > > There isn't a valid way to reproduce this issue. It mostly works fine. = But > > this has occured with me in the past too but thought it was already > > reported. > > Could you tell us anything else regarding the circumstances when this > happens, or is it completely random? Its completely random and mostly rare. Network might be an issue. But am not sure. > How frequent is it? Its rare. > Also, could you please try using "emacs -Q" while installing and/or > upgrading packages for a while to see if you can reproduce this issue > there? There isn't a valid way to reproduce this. It happens at random, maybe due to network issues. > > To be very specific I have mostly found the .el file having 0 bytes siz= e. > > Other files mostly had sizes greater than 0 bytes. > > Which other files are you referring to? Do you mean other files inside > a multi file package? I am referring to the .el files of the package that I install using package-install. I have used an advice after package-install and also an after-init-hook function that checks for any empty file which fixes this thing for now. Its given below. (defun compro/get-empty-pkgs () "Get 0 bytes .el packages." (let ((default-directory package-user-dir)) (seq-reduce (lambda (value-list file) (if (=3D (file-attribute-size (file-attributes file)) 0) (cons file value-list) value-list)) (seq-filter (apply-partially #'s-suffix-p ".el") (seq-reduce (lambda (value-list file) (if (and (not (s-prefix-p "." file)) (file-accessible-directory-p file)) (append (seq-map (apply-partially #'concat file "/") (directory-files file)) value-list) value-list)) (directory-files "") '())) '()))) (defun compro/redownload-empty-pkgs () "Redownload empty packages." (interactive) (let* ((pkgs (compro/get-empty-pkgs)) (default-directory package-user-dir) (choice-list (list (cons (intern "Delete and re-download all") 1) (cons (intern "Manually select for re-downloading") = 2) (cons (intern "Fix everything manually") 3))) (choice (if pkgs (alist-get (intern (completing-read (concat "Some files were not properly downloaded namely " (s-join ", " pkgs) ". What action do you want to take? ") choice-list)) choice-list) 3))) (if (=3D choice 3) (when (null pkgs) (message "No empty packages were found")) (package-refresh-contents) (seq-each (lambda (file) (let* ((values (s-split "/" file)) (dir-name (car values)) (pkg-values (s-split "-" dir-name)) (pkg-name (s-join "-" (butlast pkg-values 1))) (each-choice (if (=3D choice 1) t (yes-or-no-p (concat "Delete and re-download " dir-name "? "))))) (when each-choice (delete-directory dir-name t) (ignore-errors (package-reinstall (intern pkg-name)))))) pkgs)))) (add-hook 'after-init-hook 'compro/redownload-empty-packages) (defun re-download (pkg &optional arg) "Advice for package-install." (let* ((pkg-name (symbol-name (if (package-desc-p pkg) (package-desc-name pkg) pkg))) (file-name (car (sort (seq-filter (apply-partially #'s-prefix-p pkg-name) (compro/get-empty-pkgs)) #'string-greaterp))) (dir (when file-name (car (s-split "/" file-name))))) (when dir (delete-directory dir) (ignore-errors (package-reinstall pkg))))) (advice-add 'package-install :after 're-download) My elisp skills aren't great but the above fixes my issue for now. Would be nice to have something concrete to handle this issue. Regards, Compro Prasad