Bug 498467

Summary: Cloned channel generated name is longer than limit
Product: Red Hat Satellite 5 Reporter: Corey Welton <cwelton>
Component: WebUIAssignee: Jay Dobies <jason.dobies>
Status: CLOSED CURRENTRELEASE QA Contact: John Matthews <jmatthew>
Severity: medium Docs Contact:
Priority: medium    
Version: 530CC: ipilcher, jason.dobies, jfenal, mzazrivec
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 20:36:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 456985    

Description Corey Welton 2009-04-30 16:00:40 UTC
Description of problem:
When cloning some channels -- for example, the RHEL 5 RHN Tools channel for x86_64 -- the channel name field is prepopulated using characters that are not accepted input.  We shouldn't be prepopulating fields with data that the user cannot, by default, submit/accept.


Version-Release number of selected component (if applicable):

Satellite-5.3.0-RHEL5-re20090422.2-i386.iso but probably earlier.

How reproducible:
Every time.

Steps to Reproduce:
1. sync your RHEL5 x86_64 channel and associated RHN Tools channel.
2. (=) clone channel >  Clone from: Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64) 
3.  View populated fields on resulting page, and submit.
  
Actual results:

Form is submitted with value of "Clone of Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64)" in the Channel Name field, and thus channel creation fails with the following error:

Invalid channel name 'Clone of Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64)' - must be at least 6 characters long and no longer than 64 characters, begin with a letter, and contain only letters, digits, spaces, '-', ' / ', '_' and '.'


Expected results:

Default values pre-populated in fields should, by default, be valid data.

Additional info:

Comment 1 Brandon Perkins 2009-05-05 15:59:56 UTC
Changed summary to "Parenthesis are not respected as a valid character when cloning channels."  The real issue is that Red Hat and all versions of Satellite have always respected parenthesis as a valid character in channel names.  So we should allow this to work as we have in all previous versions of Satellite.  That makes this a regression that we don't allow parenthesis anymore.

Comment 2 Jay Dobies 2009-05-06 19:55:43 UTC
I'm not sure the parenthesis is the issue. I was able to clone a channel successfully with parentheses. The message is incorrect; it doesn't indicate parentheses are valid.

The example in this description fails because the name is too long (67 characters v. the maximum of 64). We need to either truncate when we generate the name or expand the name's possible length.

Comment 3 Jérôme Fenal 2009-05-06 21:59:47 UTC
FWIW, also had this issue in RHS 5.2. Limiting the name length did the trick. Same for Description IIRC.

Comment 4 Jay Dobies 2009-05-07 14:37:57 UTC
After some back and forth on the mailing list, we came up with the following:

- Increase the size of the channel name column to 256. If the Red Hat channels are already coming close to this, it's likely that the limit is too short for our needs.

- If the generated name is still too long, show a UI error about the length. This is already in place. There is an annoying amount of logic involved in the truncation and reverification that the name is unique, and it's a much more unlikely scenario with the column name increase.

Comment 5 Jay Dobies 2009-05-07 14:40:49 UTC
Also, this is basically a duplicate of 459827.

Comment 6 Jay Dobies 2009-05-07 14:49:35 UTC
Master
commit	c80bcc63b7b067b59692bc9332e0416699caab94
tree	ddf5fc4cf05fbd66fb0c208e576c2423adc830ac

Vader
commit	8537a8bd39324939affc4aaef040957ed503bbbb
tree	50023111d6686fc9876cd3f51c06d7cb770f6c59

schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/115-rhnChannel.sql

Increased size of channel name column

Comment 8 Jay Dobies 2009-05-08 14:57:26 UTC
No, it was just fixed back in January and will be in 5.3.

Comment 9 Milan Zázrivec 2009-05-14 08:40:13 UTC
(In reply to comment #6)
> Master
> commit c80bcc63b7b067b59692bc9332e0416699caab94
> tree ddf5fc4cf05fbd66fb0c208e576c2423adc830ac
> 
> Vader
> commit 8537a8bd39324939affc4aaef040957ed503bbbb
> tree 50023111d6686fc9876cd3f51c06d7cb770f6c59
> 
> schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/115-rhnChannel.sql
> 
> Increased size of channel name column  

You still need to change the definition of rhnChannel table (name column) in
rhnsat/tables/rhnChannel.sql for new installations.

Comment 10 Jay Dobies 2009-05-14 13:17:19 UTC
Thanks Milan, good pickup.

Master
commit	d461f48688232a868f1f193e69bb81a38934750d
tree	e3f69f4b6284bb52fcc67a8764149e7705b26c0a

Vader
commit	ef03621dd678acf034b019240ed9ea09ca7ab2cc
tree	cdd78ccbf8ac82de82c10ff0f5a801337d2a9224

Comment 11 John Matthews 2009-05-26 18:27:30 UTC
FAILS_QA
Tested with: Satellite-5.3.0-RHEL5-re20090520.0-i386-embedded-oracle.iso

Followed reproducer in comment #1, received error:
Invalid channel name 'Clone 2 of Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64)' - must be at least 6 characters long and no longer than 64 characters, begin with a letter, and contain only letters, digits, spaces, '-', ' / ', '_' and '.'


If I shorten the name a little it works.  From comment #4 I'm assuming the intent is to raise the limit to 256 characters?  It seems like 64 is still the limit.

I verified that the change noted in comment #10 is present on the ISO I'm using.

describe rhnchannel;
 NAME					   NOT NULL VARCHAR2(256)

Comment 12 Jay Dobies 2009-05-27 20:30:53 UTC
Ah, ok. The clone channel workflow ends on the network/software/channels/manage/edit.pxt?clone_from=102&clone_type=original page. I'm guessing that page is doing its own validation of the name before hitting the DB that needs to be updated.

Comment 13 Jay Dobies 2009-05-27 20:58:50 UTC
Master
commit	e33a7fb3ca327feb9fd393d47c2e9fbc064b1624
tree	e2886e167da779e919a9bee36c0fab8096dc2ce4

Vader
commit	bd640fc879041579c3075e3015c9a49f7b173c7d
tree	9e692d750e28ea5eda8416a4fe9234342dd9054a

java/code/webapp/WEB-INF/pages/channel/manage/edit.jsp
schema/spacewalk/rhnsat/packages/rhn_channel.pkb
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/118-rhn_channel.pkb.sql
web/modules/sniglets/Sniglets/ChannelEditor.pm

A few changes related to the channel name limit increase.

- Increased max length of create channel name text field
- Clone channel destination page updated with correct new length
- Stored proc changed; increased size of channel_name variable
- Update script for stored proc created

Comment 14 John Matthews 2009-06-08 15:35:48 UTC
ISO: Satellite-5.3.0-RHEL5-re20090529.0-i386-embedded-oracle.iso
Verified

Comment 16 Brandon Perkins 2009-09-10 20:36:19 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html