Bug 186294 - calendar(1): calendar' preprocessor process comments
Summary: calendar(1): calendar' preprocessor process comments
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-31 08:50 UTC by Romain Tartière
Modified: 2020-04-03 02:13 UTC (History)
1 user (show)

See Also:


Attachments
patch.txt (1.66 KB, text/plain)
2014-02-19 17:02 UTC, oliver
no flags Details
patch.txt (1.66 KB, text/plain)
2014-02-19 17:02 UTC, oliver
no flags Details
patch.txt (1.66 KB, text/plain)
2014-02-19 17:16 UTC, oliver
no flags Details
patch3.txt (1.69 KB, text/plain)
2014-03-03 18:54 UTC, oliver
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Tartière freebsd_committer 2014-01-31 08:50:00 UTC
After updating to 10.0, calendar now shows events it did not displayed
in 9.2.

Fix: 

No fix yet, but a workaround is to #define a macro checked in the
included calendar
---------------------------------- 8< ----------------------------------
/*
 * #define _calendar_computer_
 * #include <calendar.computer>
 */
---------------------------------- 8< ----------------------------------
How-To-Repeat: 
My ~/.calendar/calendar appears to have a commented-out comment:

---------------------------------- 8< ----------------------------------
/*
 * #include <calendar.computer>
 */

01 Jan	Sample entry
---------------------------------- 8< ----------------------------------

When I ask events for a particular date, events from this included
calendar.computer are unexpectedly returned:

---------------------------------- 8< ----------------------------------
% calendar -t 01.01
 1 jan  Sample entry
 1 jan  The Epoch (Time 0 for UNIX systems, Midnight GMT, 1970)
 1 jan  AT&T officially divests its local Bell companies, 1984
---------------------------------- 8< ----------------------------------
Comment 1 oliver 2014-02-19 17:02:47 UTC
This issue is caused by the reimplementation of some cpp features in
the application, to get rid of cpp itself. The implementation lacks
the removal of c-style /* */ comments completely.

This bug seems to be a duplicate  / same issue as PR: bin/184648

Attached is a patch that removes single-line and multi-line comments
included in the calendar files by removing them in the temporary buffer.

This patch fixes this issue and bin/184648.

Feel free to give me some feedback about the code (style) itself, the
report followup itself, etc..
Comment 2 oliver 2014-02-19 17:16:25 UTC
sorry wrong patch file, patch again - correct version.
Comment 3 Romain Tartière 2014-02-19 18:29:00 UTC
Hi Oliver,

On Wed, Feb 19, 2014 at 06:16:25PM +0100, oliver wrote:
> sorry wrong patch file, patch again - correct version.


After applying this patch, I confirm this problem is fixed.

> +    	} else if (idx_ts != NULL && idx_te == NULL) {
> +            	if (cf == 0) {
> +                	cf = 1;
> +                	while (buf++ != idx_ts); 

                        ^^^^^^^^^^^^^^^^^^^^^^^

While copying/pasting the patch, this line confused me a bit.  Isn't it
more obvious to write this as a simple assignment ?

> buf = idx_ts + 1;


Thanks!

Romain

-- 
Romain Tartière <romain@blogreen.org>        http://romain.blogreen.org/
pgp: 8234 9A78 E7C0 B807 0B59  80FF BA4D 1D95 5112 336F (ID: 0x5112336F)
(plain text =non-HTML= PGP/GPG encrypted/signed e-mail much appreciated)
Comment 4 oliver 2014-02-19 19:47:24 UTC
Hello Romain,

that is very true...when removing the original block, I didn't remove
the while condition, even stepping through is not anymore required.

Sorry, I will fix that. 

For so long, please don't commit the patch. I'm digging a bit deeper
for PR: bin/162211 and found another issue..please stand by, will
post the corrected version shortly...but need to make other
tests first.


Greetings, Oliver



>Hi Oliver,

>On Wed, Feb 19, 2014 at 06:16:25PM +0100, oliver wrote:
>> sorry wrong patch file, patch again - correct version.

>After applying this patch, I confirm this problem is fixed.

>> + } else if (idx_ts != NULL && idx_te == NULL) {
>> + if (cf == 0) {
>> + cf = 1;
>> + while (buf++ != idx_ts); 
> ^^^^^^^^^^^^^^^^^^^^^^^

>While copying/pasting the patch, this line confused me a bit. Isn't it
>more obvious to write this as a simple assignment ?

>> buf = idx_ts + 1;

>Thanks!

>Romain
Comment 5 oliver 2014-03-03 18:54:02 UTC
okay, here is my final patch for this issue and issue bin/184648

I modified my original patch for removing multiple inline comments. I
tested it against an original version of calendar and did not find any
additional issues.

Greetings, Oliver
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:26 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 7 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2020-04-03 02:13:29 UTC
Closing as OBE since the affected file was removed as a part of calendar parser rework in base r279597