Skip to content

(release_30)bugFix: fix loading of packagage/modules#360

Merged
SlySven merged 1 commit intoMudlet:release_30from
SlySven:(release_30)bugfix_packageInstallationAndReviseServerGuiHandling
Dec 11, 2016
Merged

(release_30)bugFix: fix loading of packagage/modules#360
SlySven merged 1 commit intoMudlet:release_30from
SlySven:(release_30)bugfix_packageInstallationAndReviseServerGuiHandling

Conversation

@SlySven
Copy link
Copy Markdown
Member

@SlySven SlySven commented Dec 10, 2016

This is an amalgumation of a series of commits previously applied to the
development branch:

Cleanup: clear dead code & prevent reentrancy issue in Host::installPackage

Host::installPackage(...) can call Host::uninstallPackage(...) which in
turn can call Host::installPackage(...) back. This reentrancy could cause
issues with a single instance of a QDialog used by the former which was
accessed via a class member pointer. The previous code structure avoids
this, but if the code failed to maintain the case where this is safe (when
second argument has the value of 2) there would be multiple QDialogs
created but only one could be tracked by a class member pointer. It is
possible to avoid this issue by using a method local pointer which is
enough in the new code which only uses the pointer in this method.

The previous (void)Host::showUnpackingProgress(QString) was rendered
ineffective with an immediate return statement. As such it was dead code
and removing it also negated the reason for
(void) mudlet::showUnzipProgress(const QString&) so that
(int) TLuaInterpreter::showUnzipProgress(lua_State*) is also dead code.
To avoid any breakage that has been converted into a stub that just reports
via a nil + error message that it is such a stub and can be safely removed
from scripts.

Finally, the QDialog mentioned above was not being removed when
Host::installPackage(...) failed with an error. This gave the effect of
Mudlet hanging when package/module installation failed. Note that we are
STILL woefully short of error messages in this process but that needs to
be the subject of further commits.

Refactor: remove more dead/ineffective code from Host and dlgTriggerEditor

The (bool)Host::serialize() method was short-circuited with an initial
return false; and it was only called in:
(void) dlgTriggerEditor::slot_save_edit() which did not rely on the return
value. Further examination of the latter method also revealed that all
of the dlgTriggerEditor::slot_saveXXXXAfterEdit() calls it used were just
wrappers around the corresponding dlgTriggerEditor::saveXXX() methods and
there was no other use of the public slots: wrappers so they can be
safely eliminated.

BugFix: scan for and create needed directories when installing packages

Some file archiving production systems do not seem to be inserting the
(zero length) entries with names ending in a '/' for sub-directories in
archive files. This commit now makes two passes through any package or
module and identifies all directories that will be needed, it then makes
them before it extracts the files to populate those directories.

This should fix https://bugs.launchpad.net/mudlet/+bug/1413069 as it also
ensures that the proper cleaning process is done should package
installation fail, it removes the "Unpacking" dialog on failure which was
not happening before.

NOTE: There is still an extreme lack of error reporting but as
Host::installPackage(...) is used in several places by different parts of
the application that is probably addressed separately.

Also:

  • wrapped strings in Host::installPackage(...) in QStringLiteral(...) or
    tr(...) wrappers and made it more likely to be Utf8 clean.
  • Increased the size of the buffer used during extraction of possibly
    compressed archived package files from 100 to 4096 bytes which means
    less loops will be needed to process such archived files.
  • Ensured path / file name manipulations/test are not Case Sensitive so
    that they will not misbehave on MacOS platforms.
  • Tweaked displaying of the "Unpacking package/module..." dialog so that
    it shows more consistently (it often hid under other windows on my
    GNU/Linux setup!)

Tweak: Try to ensure "Unpacking package/module" message is shown correctly

I did not detect the dialog being put up but not being properly painted on
my Linux box but Vadim did produce a screen capture video showing how the
"Unpacking ..." message was being put up on top of the Mudlet application
but the box, although the frame was displayed did not have it's internal
contents filled in. It was not clear which OS platform he got this on and
I did wonder whether it might have been a Mac which might have different
GUI systems to my Linux one, but this commit ensures that a repaint() is
used before a qApp->processEvents() call which should mean the widget is
properly filled out...

In fact this still doesn't work for some Linux systems but the reasons are
still not clear!

This is the same as the series of commits that were #345 for the development branch.

Signed-off-by: Stephen Lyons slysven@virginmedia.com

This is an amalgumation of a series of commits previously applied to the
development branch:

Cleanup: clear dead code & prevent reentrancy issue in Host::installPackage
---------------------------------------------------------------------------

Host::installPackage(...) can call Host::uninstallPackage(...) which in
turn can call Host::installPackage(...) back.  This reentrancy could cause
issues with a single instance of a QDialog used by the former which was
accessed via a class member pointer.  The previous code structure avoids
this, but if the code failed to maintain the case where this is safe (when
second argument has the value of 2) there would be multiple QDialogs
created but only one could be tracked by a class member pointer.  It is
possible to avoid this issue by using a method local pointer which is
enough in the new code which only uses the pointer in this method.

The previous (void)Host::showUnpackingProgress(QString) was rendered
ineffective with an immediate return statement.  As such it was dead code
and removing it also negated the reason for
 (void) mudlet::showUnzipProgress(const QString&) so that
 (int) TLuaInterpreter::showUnzipProgress(lua_State*) is also dead code.
To avoid any breakage that has been converted into a stub that just reports
via a nil + error message that it is such a stub and can be safely removed
from scripts.

Finally, the QDialog mentioned above was not being removed when
Host::installPackage(...) failed with an error.  This gave the effect of
Mudlet hanging when package/module installation failed.  Note that we are
STILL woefully short of error messages in this process but that needs to
be the subject of further commits.

Refactor: remove more dead/ineffective code from Host and dlgTriggerEditor
---------------------------------------------------------------------------

The (bool)Host::serialize() method was short-circuited with an initial
"return false;" and it was only called in:
(void) dlgTriggerEditor::slot_save_edit() which did not rely on the return
value.  Further examination of the latter method also revealed that all
of the dlgTriggerEditor::slot_saveXXXXAfterEdit() calls it used were just
wrappers around the corresponding dlgTriggerEditor::saveXXX() methods and
there was no other use of the "public slots:" wrappers so they can be
safely eliminated.

BugFix: scan for and create needed directories when installing packages
---------------------------------------------------------------------------
Some file archiving production systems do not seem to be inserting the
(zero length) entries with names ending in a '/' for sub-directories in
archive files.  This commit now makes two passes through any package or
module and identifies all directories that will be needed, it then makes
them before it extracts the files to populate those directories.

This should fix https://bugs.launchpad.net/mudlet/+bug/1413069 as it also
ensures that the proper cleaning process is done should package
installation fail, it removes the "Unpacking" dialog on failure which was
not happening before.

NOTE: There is still an extreme lack of error reporting but as
Host::installPackage(...) is used in several places by different parts of
the application that is probably addressed separately.

Also:
* wrapped strings in Host::installPackage(...) in QStringLiteral(...) or
 tr(...) wrappers and made it more likely to be Utf8 clean.
* Increased the size of the buffer used during extraction of possibly
 compressed archived package files from 100 to 4096 bytes which means
 less loops will be needed to process such archived files.
* Ensured path / file name manipulations/test are not Case Sensitive so
 that they will not misbehave on MacOS platforms.
* Tweaked displaying of the "Unpacking package/module..." dialog so that
 it shows more consistently (it often hid under other windows on my
 GNU/Linux setup!)

Tweak: Try to ensure "Unpacking package/module" message is shown correctly
---------------------------------------------------------------------------
I did not detect the dialog being put up but not being properly painted on
my Linux box but Vadim did produce a screen capture video showing how the
"Unpacking ..." message was being put up on top of the Mudlet application
but the box, although the frame was displayed did not have it's internal
contents filled in.  It was not clear which OS platform he got this on and
I did wonder whether it might have been a Mac which might have different
GUI systems to my Linux one, but this commit ensures that a repaint() is
used before a qApp->processEvents() call which should mean the widget is
properly filled out...

In fact this still doesn't work for some Linux systems but the reasons are
still not clear!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven changed the title BugFix: fix loading of packagage/modules {composite of several commits} (release_30)bugFix: fix loading of packagage/modules Dec 10, 2016
Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great

@SlySven SlySven merged commit a3006bb into Mudlet:release_30 Dec 11, 2016
@SlySven SlySven deleted the (release_30)bugfix_packageInstallationAndReviseServerGuiHandling branch March 16, 2017 00:36
@SlySven SlySven restored the (release_30)bugfix_packageInstallationAndReviseServerGuiHandling branch June 22, 2020 18:01
@SlySven SlySven deleted the (release_30)bugfix_packageInstallationAndReviseServerGuiHandling branch June 22, 2020 19:01
mehulmathur16 pushed a commit to mehulmathur16/Mudlet that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants