Bug 70198 - field type "time (fixed)" does not work when used in a writer template file on 32bit platforms
Summary: field type "time (fixed)" does not work when used in a writer template file o...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.0.0.beta1
Hardware: Other Windows (All)
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: BSA target:4.3.0 target:4.2.0.1 targe...
Keywords: regression
Depends on:
Blocks: mab4.1
  Show dependency treegraph
 
Reported: 2013-10-06 16:10 UTC by Thomas Heckel
Modified: 2013-12-10 18:23 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of field command with buggy behavior marked, and used custom template (74.28 KB, image/png)
2013-10-06 16:10 UTC, Thomas Heckel
Details
Template which shows errorenous behavior of time field on windows (8.03 KB, application/vnd.oasis.opendocument.text-template)
2013-10-06 20:19 UTC, Thomas Heckel
Details
test template by Cor (28.15 KB, image/png)
2013-10-06 21:10 UTC, Cor Nouws
Details
right test template by Cor (12.05 KB, application/vnd.oasis.opendocument.text-template)
2013-10-07 18:18 UTC, Cor Nouws
Details
70198_TestCor2.ott (10.52 KB, application/vnd.oasis.opendocument.text-template)
2013-10-07 20:13 UTC, Thomas Heckel
Details
Screenshot of field command "time (fixed)" showing "0:00:02" (49.22 KB, image/png)
2013-10-07 20:14 UTC, Thomas Heckel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Heckel 2013-10-06 16:10:26 UTC
Created attachment 87198 [details]
Screenshot of field command with buggy behavior marked, and used custom template

Problem description: 
When in a writer template file (.ott) the field command "time (fixed)" is used, then, when creating a new file based on this template file, the time inserted by the field command is "0:00" instead of current time of file creation.

Steps to reproduce:
1. create a new empty writer project
2. insert a field command "time (fixed)"
3. save file as template file (.ott)
4. use this file as default template when opening Writer
5. Close Writer
6. Open Writer (create a new project based on template file)

Current behavior:
--> the inserted time is "0:00".

Expected behavior:
The current time on Writer-open time was expected as in previous versions.

Operating System: Windows 7
Version: 4.1.1.2 release
Comment 1 Cor Nouws 2013-10-06 19:43:39 UTC
Hi Thomas,

Works fine for me in 4.1.2.3 on Ubuntu.
Can you pls attach the sample/test file?

Regards,
Cor
Comment 2 Thomas Heckel 2013-10-06 20:19:06 UTC
Created attachment 87209 [details]
Template which shows errorenous behavior of time field on windows

This first occurred under windows Win7 (DE localized).
I've tested again: Under LO 4.0.4.5 under Winxp on other PC the template works fine, after installation of 4.1 on the computer the template behaves with same problem as described in bug. See template attached for further tests.
Comment 3 Cor Nouws 2013-10-06 21:10:37 UTC
Created attachment 87212 [details]
test template by Cor

Hi Thomas,

thanks - indeed shows 00:00 by me too.

Can you test my template (attached) pls?
Comment 4 Thomas Heckel 2013-10-07 17:51:19 UTC
Hi Cor,

thanks for your testing!

Are you shure this is the correct attachment? This only shows an image to me, not a template.

Regards,
Thomas
Comment 5 Thomas Heckel 2013-10-07 17:51:45 UTC
Hi Cor,

thanks for your testing!

Are you sure this is the correct attachment? This only shows an image to me, not a template.

Regards,
Thomas
Comment 6 Cor Nouws 2013-10-07 18:18:00 UTC
Created attachment 87250 [details]
right test template by Cor

appologies :)
Comment 7 Thomas Heckel 2013-10-07 20:13:36 UTC
Created attachment 87254 [details]
70198_TestCor2.ott

Hi Cor,

I was now able to test your template:

Your template uses another field command (field command "file info: creation time"). My template used field command "time (fixed)"

The goal of my template is to mark the time the document window was opened (edit start time). Your field command is correct for the time the document was saved (edit stop time).

I've added the field command "time (fixed)" to your template and attached it. There you can see the difference of both field commands.
Comment 8 Thomas Heckel 2013-10-07 20:14:31 UTC
Created attachment 87255 [details]
Screenshot of field command "time (fixed)" showing "0:00:02"

While trying out I found out further, that not in all cases the field is "0:00". Indeed it seems this is dependend on the start delay of LO Writer? Sometimes I was able to produce a "0:00:02" (see screenshot attached)!
Comment 9 Cor Nouws 2013-10-08 18:51:03 UTC
Hi Thomas,

Got it now. Sometimes see 00:00:03 - better then yours ;)
The first version with the problem I have is 4.1.0beta1

thanks,
Cor
Comment 10 Michael Stahl (allotropia) 2013-12-09 19:28:32 UTC
can't reproduce problem on Linux with 4.1.1.2, current libreoffcie-4-1 or current master.
but the bug does happen on Windows on master.
Comment 11 Michael Stahl (allotropia) 2013-12-10 14:32:04 UTC
aha... when creating the document from the template the Time value gets
truncated in SwDoc::SetFixFields() (except if you've got 64 bits)
which then puts the wrong time value into the field.

this is what happens when code uses platform dependent types like "long"...

fixed on master.
Comment 12 Commit Notification 2013-12-10 14:32:29 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=17dab5bf8efb3fd676e6854474b199b681d0dc28

fdo#70198: sw: don't truncate Time values on 32bit platforms



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 13 Commit Notification 2013-12-10 14:37:13 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=9b498bb45b34a474b666107265896d69707472d1&h=libreoffice-4-2

fdo#70198: sw: don't truncate Time values on 32bit platforms


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 14 Commit Notification 2013-12-10 15:23:48 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f0d031c19c45d680b3d468c58a912da2a3ce4c78&h=libreoffice-4-1

fdo#70198: sw: don't truncate Time values on 32bit platforms


It will be available in LibreOffice 4.1.5.

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 15 Commit Notification 2013-12-10 16:04:39 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-1-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1a37462bb59f036b5b871e6f1361c4b2fd216481&h=libreoffice-4-1-4

fdo#70198: sw: don't truncate Time values on 32bit platforms


It will be available already in LibreOffice 4.1.4.

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 16 Cor Nouws 2013-12-10 18:23:43 UTC
thanks Michael!