mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > YAFU

Reply
 
Thread Tools
Old 2022-09-24, 20:08   #485
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

23·479 Posts
Default

I spent the last 2 hours trying to track down an off-by-one error in my own code, only to find there's a bug in YAFU v2.10 (and probably other versions) handling of batchfile inputs.

bug: YAFU ignores the last line in a batchfile input file if the last line doesn't have a linebreak at the end. What makes this bad is that it not only doesn't do the last assignment, but it thinks it's done everything and erases the batchfile input file, deleting the last assignment line:
eof; done processing batchfile

Adding a linebreak after the last assignment fixes the problem for now, but this is unexpected behavior.
James Heinrich is offline   Reply With Quote
Old 2022-09-24, 23:43   #486
slandrum
 
Jan 2021
California

7078 Posts
Default

Quote:
Originally Posted by James Heinrich View Post
I spent the last 2 hours trying to track down an off-by-one error in my own code, only to find there's a bug in YAFU v2.10 (and probably other versions) handling of batchfile inputs.

bug: YAFU ignores the last line in a batchfile input file if the last line doesn't have a linebreak at the end. What makes this bad is that it not only doesn't do the last assignment, but it thinks it's done everything and erases the batchfile input file, deleting the last assignment line:
eof; done processing batchfile

Adding a linebreak after the last assignment fixes the problem for now, but this is unexpected behavior.
While this is unexpected behavior, it's not uncommon behavior. I've run across many programs that require a line break at the end of the last line of an input file to function properly.

It's happened to me often enough that it makes me uncomfortable whenever I see the last line in a text file not terminated by a line break.

Last fiddled with by slandrum on 2022-09-24 at 23:46
slandrum is offline   Reply With Quote
Old 2022-09-25, 11:39   #487
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

10,093 Posts
Default

Quote:
Originally Posted by slandrum View Post
it makes me uncomfortable whenever I see the last line in a text file not terminated by a line break.
same here
LaurV is offline   Reply With Quote
Old 2022-09-25, 11:49   #488
kruoli
 
kruoli's Avatar
 
"Oliver"
Sep 2017
Porta Westfalica, DE

23·11·13 Posts
Default

It's definitely not "not uncommon" to simply delete whatever is on the last line only because it does not have a line feed at the end. Usually, the file then is handled as being empty and the last line will stay there.

To chime in, I feel uncomfortable whenever I see files that end in a new line, why should it be there? It is literally wasted space. So I am thankful e.g. vim does not show it by default.

If programs would handle files without a line break at the end normally, this would not cause problems for those that like to have the newline in the end. The opposite is not true, though.
kruoli is offline   Reply With Quote
Old 2022-09-25, 17:42   #489
BudgieJane
 
BudgieJane's Avatar
 
"Jane Sullivan"
Jan 2011
Beckenham, UK

32×5×7 Posts
Default

Quote:
Originally Posted by kruoli View Post
It's definitely not "not uncommon" to simply delete whatever is on the last line only because it does not have a line feed at the end. Usually, the file then is handled as being empty and the last line will stay there.

To chime in, I feel uncomfortable whenever I see files that end in a new line, why should it be there? It is literally wasted space. So I am thankful e.g. vim does not show it by default.

If programs would handle files without a line break at the end normally, this would not cause problems for those that like to have the newline in the end. The opposite is not true, though.
I think the purpose of that line feed on the last line is to signify that the last line is complete and nothing is missing.
BudgieJane is offline   Reply With Quote
Old 2022-09-25, 17:57   #490
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

23×479 Posts
Default

If YAFU would process lines with \n as assignments, but leave anything in the file that it doesn't understand I wouldn't have a problem with it, it's the silent ignore-and-delete that bothers me.
James Heinrich is offline   Reply With Quote
Old 2022-09-25, 18:03   #491
kruoli
 
kruoli's Avatar
 
"Oliver"
Sep 2017
Porta Westfalica, DE

47816 Posts
Default

Quote:
Originally Posted by bsquared View Post
No, that's not right. Thanks, I'll take a look.
This happens to my Ivy Bridgy, too, even with the most recent tune fix.
kruoli is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
yafu ignoring yafu.ini chris2be8 YAFU 9 2022-02-17 17:52
Running YAFU via Aliqueit doesn't find yafu.ini EdH YAFU 8 2018-03-14 17:22
YAFU-1.34 bsquared YAFU 119 2015-11-05 16:24
Yafu bug. storflyt32 YAFU 2 2015-06-29 05:19
yafu 1.32 bsquared YAFU 28 2012-07-20 16:17

All times are UTC. The time now is 00:46.


Mon Sep 26 00:46:21 UTC 2022 up 38 days, 22:14, 0 users, load averages: 0.98, 1.00, 1.08

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔