Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff URLs truncated #26

Closed
xurizaemon opened this issue May 8, 2020 · 4 comments
Closed

Diff URLs truncated #26

xurizaemon opened this issue May 8, 2020 · 4 comments

Comments

@xurizaemon
Copy link
Contributor

xurizaemon commented May 8, 2020

Just testing this out (thanks!) and noticed that some of the URLs provided for compare are truncated. Eg:

| drupal/entity_reference_revisions     | 1.7.0        | 1.8.0        | https://git.drupalcode.org/project/entity_reference_revisions/compare/8.x-1.7...8.x-1.8  |
| drupal/fast_404                       | 1.0.0-alpha4 | 1.0.0-alpha5 | https://git.drupalcode.org/project/fast_404/compare/8.x-1.0.0-alph...8.x-1.0.0-alph      |
| drupal/page_manager                   | 4.0.0-beta4  | 4.0.0-beta5  | https://git.drupalcode.org/project/page_manager/compare/8.x-4.0.0-bet...8.x-4.0.0-bet    |
| drupal/views_data_export              | 1.0.0-beta4  | 1.0.0-rc1    | https://git.drupalcode.org/project/views_data_export/compare/8.x-1.0.0-bet...8.x-1.0.0-r |

(I've intentionally excerpted to show a single correct URL and some that are not working links.)

These output URLs do not provide comparison views correctly, while most do:

In worst case this might result in deceptive output (eg diff vs -beta1 links to -beta, or diff vs -beta11 links to -beta1).

tput cols returns 236; these are not shortened due to limitations of the console AFAICT. See screenshot below.

image

@davidrjonas
Copy link
Owner

davidrjonas commented May 8, 2020 via email

@xurizaemon
Copy link
Contributor Author

xurizaemon commented May 8, 2020

The cause isn't obvious to me either. It would be remiss to not share this E_NOTICE output, even though I don't think it's related.

PHP Notice:  Undefined property: stdClass::$source in /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff on line 212
PHP Stack trace:
PHP   1. {main}() /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff:0
PHP   2. diff() /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff:9
PHP   3. makeCompareUrl() /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff:65
PHP Notice:  Trying to get property 'url' of non-object in /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff on line 212
PHP Stack trace:
PHP   1. {main}() /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff:0
PHP   2. diff() /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff:9
PHP   3. makeCompareUrl() /vagrant/.composer/vendor/davidrjonas/composer-lock-diff/composer-lock-diff:65

(that appears twice in the output, but not as many times as there are truncated URLs, therefore I doubt it's the cause ... but it is coming from makeCompareUrl so maybe I'm wrong!)

If I can't track the problem down I'll attach a sample composer.json & lock to demo 😁

@davidrjonas
Copy link
Owner

The truncation is strange. The second line of your example is truncated at 14 characters and the next two are at 13. The only place in the code that manipulates the version received from the lock files is 75 and that truncates to 7 places for git hashes. Can you provide the source files?

Also, are you using a current version? Line 212 is

return call_user_func($func, @$pkg->source->url, $diff[$pkg->name][0], $diff[$pkg->name][1]);

The @ should suppress those notices.

@davidrjonas
Copy link
Owner

I think this is corrected with the changes to drupalcode handling in 1.6.0. Please reopen if it is not.

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

No branches or pull requests

2 participants