Bug Hunting Session
Bug 72452 - ODF import: style:page-number "auto" sets Page Number offset to 0
Summary: ODF import: style:page-number "auto" sets Page Number offset to 0
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.0.beta1
Hardware: Other All
: high critical
Assignee: Michael Stahl (CIB)
URL:
Whiteboard: BSA odf Confirmed:4.2.0.0.beta2:Ubunt...
Keywords: regression
Depends on:
Blocks: mab4.2
  Show dependency treegraph
 
Reported: 2013-12-07 20:46 UTC by Al Maloney
Modified: 2017-03-01 11:31 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer document (30.13 KB, application/vnd.oasis.opendocument.text)
2013-12-07 22:52 UTC, Al Maloney
Details
Affected template (8.81 KB, application/vnd.oasis.opendocument.text-template)
2013-12-08 03:03 UTC, Al Maloney
Details
Writer Guide: WG4017-KeyboardShortcuts.odt (86.20 KB, application/vnd.oasis.opendocument.text)
2013-12-08 11:34 UTC, manj_k
Details
page field type "previous" with offset 1 (17.95 KB, application/vnd.oasis.opendocument.text)
2013-12-11 15:55 UTC, Regina Henschel
Details
Screenshot Page Break with Style Page And Number.png (7.87 KB, image/png)
2013-12-14 11:07 UTC, pierre-yves samyn
Details
Document with page break and style page change (10.76 KB, application/vnd.oasis.opendocument.text)
2013-12-14 11:09 UTC, pierre-yves samyn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Al Maloney 2013-12-07 20:46:57 UTC
Problem description:
Using 4.2.0 beta 1 and 2 on Mac OS 10.9 (Mavericks).
The field for Page Number begins at 0 instead of 1.
 

Steps to reproduce:
1. Using Insert->Fields->Page Number
2. ....
3. ....

Current behavior:
The first page begins at 0

Expected behavior:
The first page begins at 1

              
Operating System: Mac OS X
Version: 4.2.0.0.beta1
Last worked in: 4.1.3.2 release
Comment 1 Julien Nabet 2013-12-07 21:49:35 UTC
On pc Debian x86-64 with master sources updated today, I don't reproduce this.

Do you reproduce this with a brand new file?
Comment 2 Cor Nouws 2013-12-07 22:27:36 UTC
@ Al Maloney : pls attach your (test) file.

thanks,
Cor
Comment 3 Al Maloney 2013-12-07 22:52:28 UTC
Created attachment 90434 [details]
Writer document
Comment 4 Julien Nabet 2013-12-07 23:23:38 UTC
I noticed this during opening:
warn:unotools.misc:12577:1:unotools/source/misc/mediadescriptor.cxx:744: caught Exception "an error occurred during file opening" while opening <file:///home/julien/compile-libreoffice/Library/Application%20Support/LibreOfficeDev/4/user/template/AM_Num.ott>

Would it be possible you attach the template too?
Do you reproduce the problem without using this template?
Comment 5 Al Maloney 2013-12-08 03:03:07 UTC
Created attachment 90438 [details]
Affected template

Mea culpa!

The problem lies in my templates.
I removed the Library->Application Support->LibreOfficeDev directory.
I then restarted LibreOfficeDev 4.2.0 beta 2 to create a new directory.
The problem did not occur in new documents but persisted in existing documents.

Most of the templates (at least 12) in my original Library->Application Support->LibreOfficeDev directory reproduce the numbering problem. A few do not.

This frightens me.
What can I do for the 1000+ affected documents that I have (when I want to migrate to LibreOffice 4.2)?
Comment 6 Julien Nabet 2013-12-08 08:34:10 UTC
There's some doc here https://wiki.documentfoundation.org/images/3/35/WG40-WriterGuideLO.pdf about Writer and more specifically the templates.
It talks about an extension "Template Changer" but this one is not compatible anymore with LO 4
So I've no idea.

Michael: any suggestion?
Comment 7 Julien Nabet 2013-12-08 08:39:08 UTC
Andre: I just noticed you're the author of the Template Manager extension so I thought this tracker might interest you.
Comment 8 manj_k 2013-12-08 11:31:34 UTC
v4.2.0.0.beta2
Win7 64b

The same issue with my customized default template (and all documents, based on this template). Page numbering works fine from v3.3.0 to v4.1.3.2), page numbering begins now with zero in v4.2.0.0.beta2.


Another example:
https://wiki.documentfoundation.org/Documentation/Publications#LibreOffice_Writer_Guide
WG4017-KeyboardShortcuts.odt

Open the attached WG4017-KeyboardShortcuts.odt with v4.1.3.2:
the last page number is 16

Open the attached WG4017-KeyboardShortcuts.odt with v4.2.0.0.beta2:
the last page number is 12,
original page number 3 → now page number 0
original page number 4 → now page number 0
original page number 5 → now page number 1
etc.
Comment 9 manj_k 2013-12-08 11:34:21 UTC
Created attachment 90451 [details]
Writer Guide: WG4017-KeyboardShortcuts.odt
Comment 10 Al Maloney 2013-12-08 11:43:07 UTC
André's Template Changer 1.2.7b functions in LODev 4.1.5 but not in 4.2 (on Mac OS 10.9)

Al
Comment 11 manj_k 2013-12-08 12:03:37 UTC
(In reply to comment #6, #10)
> [...]
> It talks about an extension "Template Changer" but this one is not
> compatible anymore with LO 4
> So I've no idea. [...]


See: https://bugs.freedesktop.org/show_bug.cgi?id=60592#c8

template-changer-1.2.7b.oxt 
works fine for me in v4.1.3.2/v4.1.4.1, no success in v4.2.0.0.beta2.
Comment 12 Al Maloney 2013-12-11 09:34:50 UTC
The priority and severity should be increased from medium/normal.
This is a show-stopper for anyone who has page numbers in their documents.
It also affects the Guide documentation.
Comment 13 manj_k 2013-12-11 11:13:12 UTC
Added to Bug 65675 LibreOffice 4.2 most annoying bugs:

<quote>
Nominating Bug 72452 - Other: Page Number begins at 0.

Just compare the different page numbering in the recently published "LibreOffice 4.1 Draw Guide", DG41-DrawGuideLO.odt[1] – at first with LO v4.1.3.2 (correct), and then with LO-Dev v4.2.0.0.beta2 (messed up).

[1] https://wiki.documentfoundation.org/Documentation/Publications#LibreOffice_Draw_Guide (Full book 4.1.x branch)
</quote>


Modifying "Importance" to "high/critical".
Comment 14 Regina Henschel 2013-12-11 15:55:04 UTC
Created attachment 90612 [details]
page field type "previous" with offset 1

Introducing number 0 as regular page number breaks the method to get a first page without page number, which is described in the specification part 1 section 19.863.3
<quote>
Note: To display the current page number on all pages except the first or last page, use a combination of the text:select-page and text:page-adjust attributes.
</quote>

In LO4.3 the number is displayed on the first page too, in LO4.1 it is not displayed.
Comment 15 Al Maloney 2013-12-13 02:07:22 UTC
My son, who is a programmer, asks if this is a C++ issue since numbering begins with 0 in C++. If so, he suggests that it might take 15 seconds to solve the problem.
Comment 16 Julien Nabet 2013-12-13 06:22:56 UTC
Al: indeed LO is mainly made with C++.

If he thinks to solve it in 15 seconds, great!
To help him, he may begin to read this page:
https://wiki.documentfoundation.org/Development
Comment 17 pierre-yves samyn 2013-12-14 11:06:54 UTC
Hello

My observations are the following:
- The problem does not occur only on the first page
- It occurs when inserting a page break with "Page style" change and continuous numbering (see screenshot)

In the WG3617-KeyboardShortcuts the "Contents" paragraph applies "OOoFrontMatter" style.

A simpler example in the PageNumber attached document.

Reproduce on windows 7/64 & 

- Version: 4.2.0.0.beta2
Build ID: 1a27be92e320f97c20d581a69ef1c8b99ea9885d

- 4.2.0.0.beta2+
Build ID: 4031765b004dded31f04c54f9a055b7a3d0053f2
TinderBox: Win-x86@42, Branch:libreoffice-4-2, Time: 2013-12-14_01:35:27

Regards
Pierre-Yves
Comment 18 pierre-yves samyn 2013-12-14 11:07:36 UTC
Created attachment 90762 [details]
Screenshot Page Break with Style Page And Number.png
Comment 19 pierre-yves samyn 2013-12-14 11:09:00 UTC
Created attachment 90763 [details]
Document with page break and style page change
Comment 20 Robinson Tryon (qubit) 2013-12-14 11:18:12 UTC
CONFIRMED on LO 4.2.0.0.beta2 + Ubuntu 12.04.3
(Using repro steps in comment #8)

Noted as regression in keywords, so removing 'PossibleRegression' from Whitebaord.
Comment 21 Michael Stahl (CIB) 2013-12-17 11:04:37 UTC
regression from:

commit c2ccd20c0fd92bddfff76447754541705e3eb8f3
Author:     Adam Co <rattles2013@gmail.com>
AuthorDate: Thu Aug 29 17:16:44 2013 +0300
Commit:     Miklos Vajna <vmiklos@collabora.co.uk>
CommitDate: Tue Oct 22 09:53:53 2013 +0200

    fdo#44689: fix for specific case of page restart-value 0
    
    This bug fix is for roundtripping a DOCX that has
    a specific 'start value' for the page numbers.
    In most cases LO imports it ok.
    However - until now - Word allowed you to start page number
    from 0, while LO only allowed starting page numbers from 1.
    This was because the 'start value' was stored in an 'unsigned int',
    and the value '0' was used to mark 'there is no start value'.
    This patch changes the way the 'start value' is stored
    from 'unsigned int' to 'optional unsigned int'.
    This way - if there is no value applied - the variable will hold NULL.
    However - if a value is set - it can be 0 or more.
    This meant also tweaking all the places that used to get this value,
    so that now they handle an 'optional uint', instead of a 'uint'.
Comment 22 Michael Stahl (CIB) 2013-12-17 23:17:05 UTC
fixed on master
Comment 23 Commit Notification 2013-12-17 23:17:39 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=22355042a6fc7aecf3caab69b3fa3be1430b697f

fdo#72452: ODF import/export: fix handling of style:page-number



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 24 Commit Notification 2013-12-18 12:23:57 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3a5f11f6dd086efdb40e1e75e6588b4c62881918&h=libreoffice-4-2

fdo#72452: ODF import/export: fix handling of style:page-number


It will be available in LibreOffice 4.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 25 Al Maloney 2013-12-19 14:33:11 UTC
My page numbering problem appears to be resolved with
lo-4-2_tb~2013-12-19_01.08.44_LibreOfficeDev_4.2.0.1.0_MacOS_x86

Al Maloney
Comment 26 retired 2013-12-19 15:06:07 UTC
Setting to verified.
Comment 27 manj_k 2013-12-19 17:44:43 UTC
Many thanks, Michael.
VERIFIED also with
LibreOfficeDev Version: 4.3.0.0.alpha0+
Build ID: 65e6d651ceef55f569521a4f4e609f7e5e88847b
TinderBox: Win-x86@47-TDF, Branch:master, Time: 2013-12-18_23:26:17
on Win7_x64.