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

Leading space not shown in a CHAR column when browsing table #16095

Closed
dinosore opened this issue Apr 25, 2020 · 20 comments · Fixed by #16364 or #16484
Closed

Leading space not shown in a CHAR column when browsing table #16095

dinosore opened this issue Apr 25, 2020 · 20 comments · Fixed by #16364 or #16484
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@dinosore
Copy link

Describe the bug

I have a table with a CHAR(4) column where the contents are right aligned. Some rows have a leading space, but phpmyadmin shows the column left aligne.

To Reproduce

  1. Create and populate a table like the one below. (I did it with phpmyadmin).
  2. Browse the table with phpmyadmin.
  3. Observe that the CHAR column appears left aligned even though the first 9 rows have a leading space.
	MariaDB [play]> describe day_ord;
	+----------+---------------------+------+-----+---------+-------+
	| Field    | Type                | Null | Key | Default | Extra |
	+----------+---------------------+------+-----+---------+-------+
	| cardinal | tinyint(3) unsigned | NO   | PRI | NULL    |       |
	| ordinal  | char(4)             | NO   |     | th      |       |
	+----------+---------------------+------+-----+---------+-------+
	2 rows in set (0.001 sec)	

	MariaDB [play]> select * from day_ord;
	+----------+---------+
	| cardinal | ordinal |
	+----------+---------+
	|        1 |  1st    |
	|        2 |  2nd    |
	|        3 |  3rd    |
	|        4 |  4th    |
	|        5 |  5th    |
	|        6 |  6th    |
	|        7 |  7th    |
	|        8 |  8th    |
	|        9 |  9th    |
	|       10 | 10th    |
	|       11 | 11th    |
	|       12 | 12th    |	
	+----------+---------+
	12 rows in set (0.000 sec)

Expected behaviour

phpmyadmin to show leading space.

Screenshots

If applicable, add screenshots to help explain your problem.

Server configuration

  • Operating system: Debian 10
  • Web server: Apache/2.4.38 (Debian)
  • Database version: 10.3.22-MariaDB-0+deb10u1 Debian 10
  • PHP version: 7.0.33-0+deb9u3
  • phpMyAdmin version: 4.6.6deb4

Client configuration

  • Browser:
  • Operating system:

Additional context

Add any other context about the problem here.

@ibennetch
Copy link
Member

I agree there's a problem here.

It looks to me like only the first leading space is truncated.

image

Here, 'bar' should have one space in front of it, and 'baz' has several. Looking at the generated HTML, I see <span>bar</span>. So somewhere we aren't properly handling the first space.

This goes back at least as far as 4.6.6, but since that version isn't supported anymore our fix would target the QA_5_0 branch for the 5.0.x release line. You can get our packaged version from the Ubuntu PPA which will also work on Debian.

@ibennetch ibennetch added the Bug A problem or regression with an existing feature label Apr 25, 2020
@williamdes
Copy link
Member

williamdes commented Apr 25, 2020

#15236 for Debian and #15515 for Ubuntu (#15515 (comment))

@dinosore
Copy link
Author

Thank you both for your prompt replies. I'm happy that this minor issue targets the latest release.

The server has buster-backports in its sources.list and is updates & upgrades via a daily cron job.

So, if i understand #15236 (comment) correctly, I should already be on the latest stable release.

Perhaps I should have commented in #15236.

@williamdes
Copy link
Member

Thank you both for your prompt replies. I'm happy that this minor issue targets the latest release.

The server has buster-backports in its sources.list and is updates & upgrades via a daily cron job.

So, if i understand #15236 (comment) correctly, I should already be on the latest stable release.

Perhaps I should have commented in #15236.

The latest 4.9 release is available.
Much more work is needed to package 5.0 versions into our PPA and Debian.
So my very very optimistic hope to have 5.0 available in Debian and Ubuntu PPA would be in a month or two depending on my free-time and a lot more variables :)

I am glad that you are ready to upgrade ;)

@williamdes williamdes added this to Needs triage in issues via automation Apr 26, 2020
@williamdes williamdes added this to the 5.0.3 milestone Apr 26, 2020
@williamdes williamdes moved this from Needs triage to to be fixed soon in issues Apr 26, 2020
@ibennetch
Copy link
Member

You did the right thing opening a new issue here, it's easier to track this way.

I don't really know how you had the phpMyAdmin 4.6.6, could you have downloaded the .deb file and installed that? You're using Debian 10 (Buster) which doesn't have any phpMyAdmin. The version you have is consistent with Debian 9 (Stretch), but that shouldn't have been offered to you. I suppose if you had recently upgraded your system from Debian 9 to 10, then it could be an old package, but then you wouldn't be getting any updates, and the -4 update (which is the most recent) was published in 2017 so this seems to be the most likely explanation to me.

I believe the way the backports work is that they're pinned with a very low priority, so they wouldn't automatically upgrade you to the backport version of phpMyAdmin. I believe you should use a command like apt-get -t buster-backports install phpmyadmin to force the upgrade. apt policy phpmyadmin may help show you all the available options.

Regardless of which version you're running, this is indeed currently a bug with all versions and hopefully it will get fixed soon. There is not yet a fix in the release pipeline but if it's an easy fix hopefully we can get it in the next version.

@williamdes
Copy link
Member

@bacherecom apt-get -t buster-backports install phpmyadmin should be in your tutorial. Indeed Isaac pointed out a scenario that is very plausible and should be covered ;)

@dinosore
Copy link
Author

@williamdes
apt-get -t buster-backports install phpmyadmin
Reading package lists... Done
E: The value 'buster-backports' is invalid for APT::Default-Release as such a release is not available in the sources

???

@dinosore
Copy link
Author

Yes I initially installed Debian 9 and did a dist-upgrade to 10.

root@hhgp:~# apt-get -t buster-backports install phpmyadmin
Reading package lists... Done
E: The value 'buster-backports' is invalid for APT::Default-Release as such a release is not available in the sources
root@hhgp:~# apt-get -t buster install phpmyadmin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
phpmyadmin is already the newest version (4:4.6.6-4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@hhgp:~# apt-get -t stretch install phpmyadmin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
phpmyadmin is already the newest version (4:4.6.6-4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

@ibennetch
Copy link
Member

I believe this error indicates that backports is not configured for your system. Do you see a line about backports in /etc/apt/sources.list or any of the files in /etc/apt/sources.list.d/ ? You could probably grep -Ri backports /etc/apt/* to check them all at once.

@dinosore
Copy link
Author

@ibennetch

root@hhgp:~# cat /etc/apt/sources.list.d/backports.list 
deb http://ftp.debian.org/debian stretch-backports main contrib non-free
# deb http://mirrors.linode.com/debian stretch-backports main contrib non-free
root@hhgp:~# 

Same with either commented out.

@dinosore
Copy link
Author

dinosore commented Apr 26, 2020

oops - will try buster...
edit: ok, it installed with -t buster-backports
irriot!

@dinosore
Copy link
Author

dinosore commented Apr 28, 2020

After installing with -t buster-backports, trying to get to the login page I got the message PHP Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line 58

A bit of googlinng told me of a dependency on >=php7.1.

I found I was running 7.0, but 7.3 was also installed. However apache module php7.3 was not.

apt install libapache2-mod-php7.3
 a2dismod php7.0
a2enmod php7.3
systemctl restart apache2

and aok.

issues automation moved this from to be fixed soon to Closed Apr 28, 2020
@dinosore dinosore reopened this Apr 28, 2020
issues automation moved this from Closed to Needs triage Apr 28, 2020
@lem9
Copy link
Contributor

lem9 commented May 1, 2020

Maybe we need this option in the CSS for the span: white-space:pre;

@williamdes
Copy link
Member

Maybe we need this option in the CSS for the span: white-space:pre;

I agree, but it could have rendering effects on text contents.

@lem9
Copy link
Contributor

lem9 commented May 2, 2020

Yes, not sure if there can be a universal solution.

@williamdes williamdes moved this from Needs triage to to be fixed soon in issues May 3, 2020
@williamdes williamdes moved this from to be fixed soon to Low priority in issues May 3, 2020
petrduda added a commit to petrduda/phpmyadmin that referenced this issue Sep 19, 2020
petrduda added a commit to petrduda/phpmyadmin that referenced this issue Sep 19, 2020
Signed-off-by: Petr Duda <petrduda@seznam.cz>
@petrduda
Copy link
Contributor

Hello, may I suggest the following solution?

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Sep 19, 2020
petrduda added a commit to petrduda/phpmyadmin that referenced this issue Sep 20, 2020
Signed-off-by: Petr Duda <petrduda@seznam.cz>
@ibennetch ibennetch modified the milestones: 5.0.3, 5.0.4, 5.0.5 Oct 10, 2020
williamdes pushed a commit to petrduda/phpmyadmin that referenced this issue Nov 2, 2020
…umeric columns

Signed-off-by: Petr Duda <petrduda@seznam.cz>
@williamdes williamdes modified the milestones: 5.0.5, 5.1.0 Nov 2, 2020
@williamdes
Copy link
Member

before

image

after

image

@williamdes williamdes self-assigned this Nov 12, 2020
williamdes added a commit that referenced this issue Nov 12, 2020
…when browsing table

Issue: #16095
Pull-request: #16364
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Nov 12, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Low priority to Closed Nov 12, 2020
@williamdes
Copy link
Member

Hi @petrduda
I merged your work, could you let me know if this is expected for new lines (see screenshot above) ?

-- phpMyAdmin SQL Dump
-- version 5.1.0-dev
-- https://www.phpmyadmin.net/
--
-- Hôte : mariadb104.williamdes.local:3306
-- Généré le : jeu. 12 nov. 2020 à 21:43
-- Version du serveur :  10.4.10-MariaDB-1:10.4.10+maria~bionic
-- Version de PHP : 8.0.0-dev

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


CREATE TABLE `leading-space` (
  `id` int(11) NOT NULL,
  `ord` char(4) DEFAULT 'th',
  `txt` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `leading-space` (`id`, `ord`, `txt`) VALUES
(1, ' 1st', ''),
(2, ' 2nd', ''),
(3, ' 3rd', ''),
(4, ' 4th', ''),
(5, ' 5th', ''),
(6, ' 6th', ''),
(7, ' 7th', ''),
(8, ' 8th', ''),
(9, NULL, '    4 spaces\r\n  2 spaces, 1 new line');

ALTER TABLE `leading-space`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `leading-space`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
COMMIT;

petrduda added a commit to petrduda/phpmyadmin that referenced this issue Nov 15, 2020
Signed-off-by: Petr Duda <petrduda@seznam.cz>
@petrduda
Copy link
Contributor

Hello @williamdes, thank you, that is not expected, may I suggest the following fix?

@williamdes
Copy link
Member

Hello @williamdes, thank you, that is not expected, may I suggest the following fix?

Hello @petrduda
Sure!
Thank you for doing a fix, it looks good.
You can target master branch for it.

williamdes added a commit that referenced this issue Nov 15, 2020
Issue: #16095
Pull-request: #16484
Signed-off-by: William Desportes <williamdes@wdes.fr>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
5 participants