From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yLv2KqOkmWLzjQAAbAwnHQ (envelope-from ) for ; Fri, 03 Jun 2022 08:05:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iMDwKqOkmWJgTQEA9RJhRA (envelope-from ) for ; Fri, 03 Jun 2022 08:05:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4B92CD69F for ; Fri, 3 Jun 2022 08:05:23 +0200 (CEST) Received: from localhost ([::1]:34802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx0R0-0001wr-4x for larch@yhetil.org; Fri, 03 Jun 2022 02:05:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx0PC-0001wf-B4 for emacs-orgmode@gnu.org; Fri, 03 Jun 2022 02:03:30 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:43881) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx0PA-0005OV-OO for emacs-orgmode@gnu.org; Fri, 03 Jun 2022 02:03:30 -0400 Received: by mail-oi1-x230.google.com with SMTP id l84so9235016oif.10 for ; Thu, 02 Jun 2022 23:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=kC2rm6fF0UVsS/j/oQpg+5WyopEIhpqQvm10aH5Uy54=; b=DEyTqCEa5fjHQmaUG8ttOWALmXBqRIs9yVLN2ruX4/QezFiOl6pxMVn4MSx8002HWC h6c3wR+QGuV6npNCjcOfZzX0rIz/XaLn4u1FFscIR+AYHoHMfRZ64VqGUCdEVtW529BU WMZ/n2t32yJAuBedwyr1B4eCYbABbYFz7VF5MiIojPZYKzVIW0X3J6LVb1rrqiFXTBW3 KqOY83DNkvD8mFqGwv7TJopByap+E9XWr6Qzc/geeCqk8BfaengXdlg+3Oc30rD84TZU iEA0y2x/6FtrGWPc6Gvcyt0icQD09RTZ3FaB/ZI+4R7mrbJqMRhZwO7BMg6eKt64Pl2+ TlEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=kC2rm6fF0UVsS/j/oQpg+5WyopEIhpqQvm10aH5Uy54=; b=iNfwxtdCjx9WgYBMXQfyyRgdEsDgJDlFzklZ89sgVuXVHhhx4L31RqTxsNKXIXi5mO FBICQAg3hezrk4NC+/7JogT+OmIsWkokuGqnL3lHYCjVrUXgvQdqlMBYargXLePkHekX BNUPyhQqBqht5bPHcIW3h8yMKPY034COY/waao3BqU6E0Il+VwTapVmVlqz11GLget6G Dg2IqmKVcGAq3mKOLnWTMbiIhQriANBoKXPjvEPsKgr2s7JuYfWxucQMBvJk0BJSgMtz g1FRup1lxNapkdUQ7wPBG01kAR+SD5sTcwoDNwo0H9zU/oyzQGSDs91nAAs603pPgWOR dJ4Q== X-Gm-Message-State: AOAM532bwXT+JHAFMqh+pnzIiJ1ldeGUzFSMjQfUHcSVTFtgSehyui6i 6Xj6eWx6HVapnqFjbpm16M0= X-Google-Smtp-Source: ABdhPJyySr7KM1xhDxJjw89V0iHuCzas5y3c97Uwgyn2yeD9sXlpCL53pWgl3HVVerFGb3FYLbBHTg== X-Received: by 2002:aca:b786:0:b0:32b:8df1:919b with SMTP id h128-20020acab786000000b0032b8df1919bmr12054193oif.190.1654236207219; Thu, 02 Jun 2022 23:03:27 -0700 (PDT) Received: from localhost ([104.223.98.2]) by smtp.gmail.com with ESMTPSA id j6-20020a4adf46000000b0035eb4e5a6b8sm3279812oou.14.2022.06.02.23.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 23:03:26 -0700 (PDT) From: Ihor Radchenko To: Gregor Zattler Cc: emacs-orgmode@gnu.org Subject: [BUG, confirmed] org-clock-in calling org-clock-sum fails leaving incomplete CLOCK line when encountering existing malformed CLOCK lines In-Reply-To: <87h754bdlk.fsf@no.workgroup> References: <87o7zfoze0.fsf@no.workgroup> <877d621ejm.fsf@localhost> <87h754bdlk.fsf@no.workgroup> Date: Fri, 03 Jun 2022 14:04:04 +0800 Message-ID: <87y1yecmgb.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=yantar92@gmail.com; helo=mail-oi1-x230.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654236323; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=kC2rm6fF0UVsS/j/oQpg+5WyopEIhpqQvm10aH5Uy54=; b=Mc+0aLcFusXUHr945Hp0XyCC/5RDxpIv8CMWwbHjYO04ccgaBFIEJAG3fUt6XFc9XHGW8N kVmRegLXXeY2Fxc4n/QSpDLog0EcL2PL6kOu70JL83MI54R0G8Fkk8ZHs4egTL2WgiI6C3 rojUmtsFakvviZ2UcLs1QNpeZxND3pCWMSFaQhGnLnq6qOw5FJtITT4bl8vFtVsBULzvAF PhiPz8t8ZrpbVMagD4xYsDGql8m/NTN4pJwxv8jnz815kIKZ8gIiy58n8KAc3U5FwaOst2 J6Mp4GHBDQH3Egk8EY3GbOvxrLdrki+avM6jHsNZ4PbkvpCmDAkVXmbmhKDV6A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654236323; a=rsa-sha256; cv=none; b=KiI0qvMZRasON5rFP9OMiJ4DuvOefMiuhKKCtfzmMAaI8fUAnaC1EpO23adRFriPzJWmx7 n0RG4UXTidKBY+B4ASrY4Ec8LmWYdb5ZHjreB4D9sBLM3KYcpBik7Qvo/RI2owLfDWlAKx c+u39Eo/dmkZufrTkowF0gorw4EDhBAAbrB1c54PsSdhnAxDwt19LFMqRpzlIvH2uLwnYp P7/fy6AlaVUC7urXak5ExRkhYTEmst3m6Yngid8ezbj6QkCjfuxqJobvVqYvdD+qtPTE22 t0lwrJDrn2uLReqR9oqAIzB4JNqeg6kHHt1WuJkDK0CjI/ZxmDevFwLev6nCJQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DEyTqCEa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.52 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DEyTqCEa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4B92CD69F X-Spam-Score: -3.52 X-Migadu-Scanner: scn1.migadu.com X-TUID: vY4eR9fuYIyE Gregor Zattler writes: >>> org-parse-time-string: Not an Org time string: [20zznn22-05-30 Mo 11:34] >>> >>> And then there is a dangling >>> >>> CLOCK: >>> >>> line without timestamps at the expected line in my org file. >>> >>> It took a while till I realized that there was a corrupted >>> timestamp in my org file a few clock lines below. >> >> Could you please create an example file and detail the steps how you got >> the error? > > Please see the attached test.org and call Emacs like so: > > > /usr/local/bin/emacs-29.0.50 -Q -L ~/src/org-mode/lisp /tmp/test.org --eval '(switch-to-buffer "test.org")' -f org-clock-in Thanks! Confirmed using the described steps. This is an omission in org-clock-sum. When parsing clock lines (which org-clock-sum considers as any line starting from word CLOCK:), org-clock-sum calls org-parse-time-string. The latter throws the error you are seeing. The problem have been present at lest since Org 9.1.9. An easy fix would be catching the error and ignoring erroneous headline. An alternative could be also throwing a warning or more informative error. Another alternative could be using org-element and only parsing real clock objects + adding org-lint checker for malformed clock lines. org-lint checker will be useful in any case though. I do not consider this as a pressing issue, so I am just leaving the possible solutions above. And patches are welcome :) Best, Ihor