Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #12258 (closed)

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

BUG: omero script replace doesn't update sha1

Reported by: spli Owned by: jamoore
Priority: major Milestone: Unscheduled
Component: Scripting Version: 5.0.1
Keywords: n.a. Cc: mtbcarroll
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: n.a.

Description

Upload a file as a normal user:

$ ls -l t.py
-rw-r--r--  1 simon  staff  0  7 May 13:31 t.py
$ sha1sum t.py
da39a3ee5e6b4b0d3255bfef95601890afd80709  t.py
$ bin/omero script upload t.py
Using session a91b4705-eafb-42d9-a431-39d1e9334368 (user-4@gretzky.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-write-1
Uploaded script as original file #69014
$ bin/omero hql 'from OriginalFile where id=69014'
Using session a91b4705-eafb-42d9-a431-39d1e9334368 (user-4@gretzky.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-write-1
 # | Class         | Id    | mimetype      | hash                                     | details         | name | mtime
---+---------------+-------+---------------+------------------------------------------+-----------------+------+--------------------------
 0 | OriginalFileI | 69014 | text/x-python | da39a3ee5e6b4b0d3255bfef95601890afd80709 | owner=5;group=6 | t.py | Wed May  7 13:31:58 2014
(1 row)

Modify the file and replace:

$ echo ' ' >> t.py
$ ls -l t.py
-rw-r--r--  1 simon  staff  2  7 May 13:32 t.py
$ sha1sum t.py
dd122581c8cd44d0227f9c305581ffcb4b6f1b46  t.py
$ bin/omero script replace 69014 t.py Using session a91b4705-eafb-42d9-a431-39d1e9334368 (user-4@gretzky.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-write-1
$ bin/omero hql 'from OriginalFile where id=69014'
Using session a91b4705-eafb-42d9-a431-39d1e9334368 (user-4@gretzky.openmicroscopy.org.uk:4064). Idle timeout: 10.0 min. Current group: read-write-1
 # | Class         | Id    | mimetype      | hash                                     | name | details         | mtime                    | size
---+---------------+-------+---------------+------------------------------------------+------+-----------------+--------------------------+------
 0 | OriginalFileI | 69014 | text/x-python | da39a3ee5e6b4b0d3255bfef95601890afd80709 | t.py | owner=5;group=6 | Wed May  7 13:33:06 2014 | 2
(1 row)

The sha1 isn't updated, which for real scripts will lead to a Sha1s don't match exception.

Change History (2)

comment:1 Changed 7 years ago by jamoore

  • Cc mtbcarroll added
  • Resolution set to fixed
  • Status changed from new to closed

PR opened: https://github.com/openmicroscopy/openmicroscopy/pull/2466

Discussion to be had there.

comment:2 Changed 7 years ago by jmoore <josh@…>

  • Remaining Time set to 0

(In [48bf5c1a1c9556b5f9f0b101ffe099f46ff1af70/ome.git] on branch develop) Set hasher on newly created scripts (Fix #12258)

The hash for non-official scripts was being correctly
set, but not the hasher itself. The check on save in
RawFileBean?.java does nothing if a hasher is missing.

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.100084 sec.)

We're Hiring!