![]() |
#16 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,059
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() ![]() The Mod list is from day 1. Not all are active (or even alive now). Our coverage is very good as we have folk in many different Timezones. We take the day-to-day load off the Greenies (Do use the Report Post button if the Guidelines have been violated as they are the only ones that can solve that) Take a few (and read the various threads) and you will see who is still active frequently. Your post has been approved 06:45, now that I have Caffeinated |
|
![]() |
![]() |
![]() |
#17 |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Dec 2022
Location: in UTC+1 TZ
Device: PocketBook Touch Lux 4
|
Quoth, theducks, thanks for explanations, I'll try to be more patient about it. And, silly me, I didn't even realize it's Christmas Eve, probably because I'm not a christian -- Merry Christmas to all who are then!
|
![]() |
![]() |
![]() |
#18 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 167
Karma: 1497966
Join Date: Jul 2021
Device: N/A
|
Or maybe something like this ?
Code:
== boss.py (line 1331) def do_save(c, path, tdir): - save_container(c, path) + save_container(c, path, save_copy=True) shutil.rmtree(tdir, ignore_errors=True) == save.py (line 28) -def save_container(container, path): +def save_container(container, path, save_copy=False): if container.is_dir: (line 35) fno = temp.fileno() - st = None + st = mode = None try: st = os.stat(path) except OSError as err: if err.errno != errno.ENOENT: raise # path may not exist if we are saving a copy, in which case we use # the metadata from the original book try: st = os.stat(container.path_to_ebook) except OSError as err: if err.errno != errno.ENOENT: raise # Somebody deleted the original file if st is not None: try: - os.fchmod(fno, st.st_mode | stat.S_IWUSR) + if save_copy: + # if the edited ebook is read-only, temporarily change its right to be able to save a copy + os.fchmod(fno, (mode := st.st_mode) | stat.S_IWUSR) + else: + os.fchmod(fno, st.st_mode) except OSError as err: if err.errno != errno.EPERM: raise raise OSError('Failed to change permissions of {} to {} ({}), with error: {}. Most likely the {} directory has a restrictive umask'.format( temp.name, oct(st.st_mode), format_permissions(st.st_mode), errno.errorcode[err.errno], os.path.dirname(temp.name))) try: os.fchown(fno, st.st_uid, st.st_gid) except OSError as err: if err.errno not in (errno.EPERM, errno.EACCES): # ignore chown failure as user could be editing file belonging # to a different user, in which case we really can't do anything # about it short of making the file update non-atomic raise - temp.close() - temp = temp.name try: + if save_copy and mode: + os.fchmod(fno, mode) container.commit(temp) atomic_rename(temp, path) finally: + temp.close() + temp = temp.name if os.path.exists(temp): os.remove(temp) Last edited by lomkiri; 12-24-2022 at 04:10 PM. Reason: Correction: I forgot to relat the change in def save_container |
![]() |
![]() |
![]() |
#19 | |||
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
Quote:
Quote:
So you need to *warn* the user and allow the user to override, not fail to save, if you want your patch accepted. |
|||
![]() |
![]() |
![]() |
#20 | |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 111
Karma: 35586
Join Date: Nov 2020
Location: Perth, Western Australia
Device: Apple Books & Kobo Libra H20
|
Quote:
Your original change to overwrite read-only files introduced a very unexpected behaviour, and was not even what the requestor asked for. |
|
![]() |
![]() |
![]() |
#21 | ||
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
Quote:
My original change had nothing to do with this OP. |
||
![]() |
![]() |
![]() |
#22 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,059
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Use the Bug icon in the Viewer to see the code.
|
![]() |
![]() |
![]() |
#23 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
And here you go now you get a warning before saving ass well as on opening: https://github.com/kovidgoyal/calibr...91735307251240
|
![]() |
![]() |
![]() |
#24 | |
Junior Member
![]() Posts: 7
Karma: 10
Join Date: Dec 2022
Location: in UTC+1 TZ
Device: PocketBook Touch Lux 4
|
I did try it but it's not even remotely as convenient as accessing all the internals of a bookfile through the Editor. Can you even see the contents of an .opf or .ncx file in the Viewer at all? I certainly can't find them there. And frankly, I don't care, since in the Editor I'm always just a double-click away of accessing the raw contents of any of all the files inside the ebook I need. So I'm just gonna keep opening my read-only files in the Editor (especially now that that botched change introduced in version 5.37 has been fixed), even though calibre assumes, wrongly, that I want to edit them.
Quote:
|
|
![]() |
![]() |
![]() |
#25 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
Popping up a warning before saving, rather than dealing with an error after saving, specially for you, is within my "jump through hoops to accommodate idiotic use cases, while still trying to get useful work done" budget. |
|
![]() |
![]() |
![]() |
#26 | ||
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 111
Karma: 35586
Join Date: Nov 2020
Location: Perth, Western Australia
Device: Apple Books & Kobo Libra H20
|
Quote:
My comment about the requestor was not referring to the OP of this thread, but the requestor of the change to the "save" function: Quote:
|
||
![]() |
![]() |
![]() |
#27 | |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
[QUOTE=Bradles;4284528]Wow! Get up on the wrong side of the bed this morning? Your online persona can be quite brusque, to say the least. I don't think the OP deserved such an insulting response for a perfectly valid concern.
[quote] Then I suggest you and the OP stop interacting with me. You are not doing me a favor by asking me to do work for you, you do realize that dont you? Quote:
|
|
![]() |
![]() |
![]() |
#28 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,757
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I have never saved an eBook in the editor that I didn't want saved. When I close the editor and I have made some sort of change, I click the button that reads Quit without saving.
|
![]() |
![]() |
![]() |
#29 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,210
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
One of the few times I find myself agreeing with Jon.
Not to mention that I would never depend on a software flag to keep a file from being modified or overwritten. That's what creating a backup before editing is for. |
![]() |
![]() |
![]() |
#30 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,757
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I use Modify ePub before editing in most cases. It creates a backup and I have occasionally used the backup to double check something or fix something I screwed up.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Javascript files not referenced in ebook-editor | dmonasse | Editor | 2 | 04-17-2014 07:37 AM |
calibre's ebook viewer unable to open/read some .azw3 files | bauerhjb | Calibre | 1 | 05-19-2013 09:51 AM |
Associating ebook files with Calibre ebook viewer | zobop | Library Management | 1 | 06-24-2012 11:07 AM |
Calibre 0.8.12 Overwrites 'Im_Reading' and 'Read' Status on original Kobo | GMFuller | Devices | 4 | 07-31-2011 02:12 AM |