Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

#2229 closed defect (fixed)

metadata-only update sets filesize property to 0

Reported by: garycmartin Owned by: aa
Priority: Unspecified by Maintainer Milestone:
Component: Sugar Version: 0.90.x
Severity: Major Keywords: dextrose
Cc: aa, alsroot Distribution/OS:
Bug Status: Assigned

Description

Testing the latest dextrose 373pyg, when setting the Journal sort option to "View by size" and editing the name of any entry, it's size is reset to "Empty". Only by resuming the entry will the size correctly show again.

Steps to reproduce:

  • switch to Journal
  • right click on the "Sort by" icon (FWIW 373pyg has the button incorrectly labeled "List view")
  • select "View by size"
  • click on the text name of any Journal entry to edit it
  • press return to OK the edit (don't actually need to change the text)
  • the Journal entry will now show as size "Empty"

Attachments (2)

Journal renaming sets size to Empty.png (63.1 KB) - added by garycmartin 9 years ago.
Note the renamed screenshot entries are all now showing "Empty", they were showing the correct size before being renamed.
2229-journal-rename-sets-size-to-empty.patch (768 bytes) - added by aa 9 years ago.

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by garycmartin

Note the renamed screenshot entries are all now showing "Empty", they were showing the correct size before being renamed.

comment:1 follow-up: Changed 9 years ago by erikos

Thanks for your report, Gary! Reproduced with the latest patches here.

- right click on the "Sort by" icon (FWIW 373pyg has the button incorrectly labeled "List view")

What would be the correct labeling here?

comment:2 Changed 9 years ago by alsroot

  • Cc aa added

comment:3 in reply to: ↑ 1 ; follow-up: Changed 9 years ago by garycmartin

Replying to erikos:

Thanks for your report, Gary! Reproduced with the latest patches here.

- right click on the "Sort by" icon (FWIW 373pyg has the button incorrectly labeled "List view")

What would be the correct labeling here?

Sorry, you're going to hate me, but you did ask ;)

Sort view


Sort by date modified
Sort by date created
Sort by size

comment:4 in reply to: ↑ 3 Changed 9 years ago by erikos

Replying to garycmartin:

Replying to erikos:

Thanks for your report, Gary! Reproduced with the latest patches here.

- right click on the "Sort by" icon (FWIW 373pyg has the button incorrectly labeled "List view")

What would be the correct labeling here?

Sorry, you're going to hate me, but you did ask ;)

Sort view


Sort by date modified
Sort by date created
Sort by size

Those are easy changes - attached screenshot to other ticket.

comment:5 Changed 9 years ago by erikos

  • Bug Status changed from Unconfirmed to Assigned
  • Milestone changed from Unspecified by Release Team to 0.90
  • Owner changed from alsroot to aa
  • Status changed from new to assigned

comment:6 follow-up: Changed 9 years ago by aa

  • Cc alsroot added
  • Keywords r? added

This bug is caused by the journal calling model.write with a default file_path argument:

    def __cell_title_edited_cb(self, cell, path, new_text):
        row = self._model[path]
        metadata = model.get(row[ListModel.COLUMN_UID])
        metadata['title'] = new_text
        model.write(metadata, update_mtime=False)
        self.cell_title.props.editable = False

The default_file path is , and so the filesize is updated with an inexistent file.

def write(metadata, file_path='', update_mtime=True, transfer_ownership=True):
...
         if metadata.get('uid', ''):
             object_id = _get_datastore().update(metadata['uid'],
                                                  dbus.Dictionary(metadata),
                                                  file_path,
                                                  transfer_ownership)

The attached patch fixes this.

comment:7 in reply to: ↑ 6 Changed 9 years ago by sascha_silbe

  • Component changed from journal to sugar-datastore
  • Distribution/OS Unspecified deleted
  • Keywords r? removed
  • Summary changed from Using Journal to rename an entry sets entry size to "Empty" when sort mode is "View by size" to metadata-only update sets filesize property to 0
  • Version changed from Unspecified to 0.90.x

Replying to aa:

The default_file path is , and so the filesize is updated with an inexistent file.

That's a bug in the data store then. Passing file_path= for an entry that already has data means updating the metadata only and leaving the data unchanged (see carquinyol.filestore.FileStore.store(); especially notice the commented out part).
If we change the API to not support metadata-only updates anymore, more than just the Journal will break.

comment:8 Changed 9 years ago by alsroot

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:9 Changed 6 years ago by dnarvaez

  • Component changed from sugar-datastore to Sugar

comment:10 Changed 6 years ago by dnarvaez

  • Milestone 0.90 deleted

Milestone 0.90 deleted

Note: See TracTickets for help on using tickets.