~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to util/mkisofs/name.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-01-11 11:12:55 UTC
  • mfrom: (17.3.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100111111255-lr8ebkqw5x41gq6j
Tags: 1.98~20100101-1ubuntu1
* Resynchronise with Debian. Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Conflict with grub (<< 0.97-54) as well as grub-legacy.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu. Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed. If it is, show the
    menu, otherwise boot immediately. If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt. Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - If the environment variable "quiet" is set to something other than 0,
    suppress progress messages as the kernel and initrd load. Set this for
    non-recovery kernel menu entries.
  - Add GRUB_DEFAULT=saved, as well as grub-set-default and grub-reboot
    utilities. Provides functionality essentially equivalent to GRUB
    Legacy's savedefault.
  - Keep the loopback file open so that subsequent changes to the "root"
    environment variable don't affect it.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Handle RAID devices containing virtio components.
* Update savedefault patch from current Bazaar branch, fixing grub-reboot
  to have distinct behaviour from grub-set-default (LP: #497326).
* Fix grub-mkisofs compilation error with FORTIFY_SOURCE.
* Convert recordfail boilerplate in each menu entry to use a function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <ctype.h>
28
28
 
29
29
extern int allow_leading_dots;
30
 
   
 
30
  
31
31
/*
32
32
 * Function:    iso9660_file_length
33
33
 *
43
43
 *              would also be nice to have.
44
44
 */
45
45
int FDECL3(iso9660_file_length,
46
 
           const char*, name, 
47
 
           struct directory_entry *, sresult, 
 
46
           const char*, name,
 
47
           struct directory_entry *, sresult,
48
48
           int, dirflag)
49
49
{
50
50
  char          * c;
69
69
   */
70
70
  if(strcmp(name,".") == 0)
71
71
    {
72
 
      if(result) 
 
72
      if(result)
73
73
        {
74
74
          *result = 0;
75
75
        }
82
82
   */
83
83
  if(strcmp(name,"..") == 0)
84
84
    {
85
 
      if(result) 
 
85
      if(result)
86
86
        {
87
87
          *result++ = 1;
88
88
          *result++ = 0;
115
115
  while(*pnt)
116
116
    {
117
117
#ifdef VMS
118
 
      if( strcmp(pnt,".DIR;1") == 0 ) 
 
118
      if( strcmp(pnt,".DIR;1") == 0 )
119
119
        {
120
120
          break;
121
121
        }
126
126
       * generated by some editors.  Lower the priority of
127
127
       * the file.
128
128
       */
129
 
      if(*pnt == '#') 
 
129
      if(*pnt == '#')
130
130
        {
131
 
          priority = 1; 
132
 
          pnt++; 
133
 
          continue; 
 
131
          priority = 1;
 
132
          pnt++;
 
133
          continue;
134
134
        }
135
135
 
136
136
      /*
138
138
       * generated by some editors.  Lower the priority of
139
139
       * the file.
140
140
       */
141
 
      if(*pnt == '~') 
 
141
      if(*pnt == '~')
142
142
        {
143
 
          priority = 1; 
144
 
          tildes++; 
145
 
          pnt++; 
 
143
          priority = 1;
 
144
          tildes++;
 
145
          pnt++;
146
146
          continue;
147
147
        }
148
148
 
170
170
       * If we have a name with multiple '.' characters, we ignore everything
171
171
       * after we have gotten the extension.
172
172
       */
173
 
      if(ignore) 
 
173
      if(ignore)
174
174
        {
175
 
          pnt++; 
 
175
          pnt++;
176
176
          continue;
177
177
        }
178
178
 
181
181
       */
182
182
      if(seen_semic)
183
183
        {
184
 
          if(*pnt >= '0' && *pnt <= '9') 
 
184
          if(*pnt >= '0' && *pnt <= '9')
185
185
            {
186
186
              *result++ = *pnt;
187
187
            }
197
197
         * option.  We still only allow one '.' character in the
198
198
         * name, however.
199
199
         */
200
 
      if(full_iso9660_filenames) 
 
200
      if(full_iso9660_filenames)
201
201
        {
202
202
          /* Here we allow a more relaxed syntax. */
203
 
          if(*pnt == '.') 
 
203
          if(*pnt == '.')
204
204
            {
205
 
              if (seen_dot) 
 
205
              if (seen_dot)
206
206
                {
207
 
                  ignore++; 
 
207
                  ignore++;
208
208
                  continue;
209
209
                }
210
210
              seen_dot++;
211
211
            }
212
 
          if(current_length < 30) 
 
212
          if(current_length < 30)
213
213
            {
214
214
              if( !isascii (*pnt))
215
215
                {
222
222
            }
223
223
        }
224
224
      else
225
 
        { 
226
 
          /* 
 
225
        {
 
226
          /*
227
227
           * Dos style filenames.  We really restrict the
228
228
           * names here.
229
229
           */
230
230
          /* It would be nice to have .tar.gz transform to .tgz,
231
231
           * .ps.gz to .psz, ...
232
232
           */
233
 
          if(*pnt == '.') 
 
233
          if(*pnt == '.')
234
234
            {
235
 
              if (!chars_before_dot && !allow_leading_dots) 
 
235
              if (!chars_before_dot && !allow_leading_dots)
236
236
                {
237
237
                  /* DOS can't read files with dot first */
238
238
                  chars_before_dot++;
239
 
                  if (result) 
 
239
                  if (result)
240
240
                    {
241
241
                      *result++ = '_'; /* Substitute underscore */
242
242
                    }
247
247
                   * If this isn't the dot that we use for the extension,
248
248
                   * then change the character into a '_' instead.
249
249
                   */
250
 
                  if(chars_before_dot < 8) 
 
250
                  if(chars_before_dot < 8)
251
251
                    {
252
252
                      chars_before_dot++;
253
 
                      if(result) 
 
253
                      if(result)
254
254
                        {
255
255
                          *result++ = '_';
256
256
                        }
257
257
                    }
258
258
                }
259
 
              else 
 
259
              else
260
260
                {
261
 
                  if (seen_dot) 
 
261
                  if (seen_dot)
262
262
                    {
263
263
                      ignore++; continue;
264
264
                    }
265
 
                  if(result) 
 
265
                  if(result)
266
266
                    {
267
267
                      *result++ = '.';
268
268
                    }
269
269
                  seen_dot++;
270
270
                }
271
271
            }
272
 
          else 
 
272
          else
273
273
            {
274
274
              if(    (seen_dot && (chars_after_dot < 3) && ++chars_after_dot)
275
275
                     || (!seen_dot && (chars_before_dot < 8) && ++chars_before_dot) )
276
276
                {
277
 
                  if(result) 
 
277
                  if(result)
278
278
                    {
279
 
                      switch (*pnt) 
 
279
                      switch (*pnt)
280
280
                        {
281
281
                        default:
282
282
                          if( !isascii (*pnt) )
289
289
                            }
290
290
                          break;
291
291
 
292
 
                        /* 
 
292
                        /*
293
293
                         * Descriptions of DOS's 'Parse Filename'
294
294
                         * (function 29H) describes V1 and V2.0+
295
295
                         * separator and terminator characters.
329
329
      current_length++;
330
330
      pnt++;
331
331
    } /* while (*pnt) */
332
 
  
 
332
 
333
333
  /*
334
334
   * OK, that wraps up the scan of the name.  Now tidy up a few other
335
335
   * things.
345
345
    {
346
346
      int prio1 = 0;
347
347
      pnt = name;
348
 
      while (*pnt && *pnt != '~') 
 
348
      while (*pnt && *pnt != '~')
349
349
        {
350
350
          pnt++;
351
351
        }
352
 
      if (*pnt) 
 
352
      if (*pnt)
353
353
        {
354
354
          pnt++;
355
355
        }
360
360
        }
361
361
      priority = prio1;
362
362
    }
363
 
  
 
363
 
364
364
  /*
365
365
   * If this is not a directory, force a '.' in case we haven't
366
366
   * seen one, and add a version number if we haven't seen one
368
368
   */
369
369
  if (!dirflag)
370
370
    {
371
 
      if (!seen_dot && !omit_period) 
 
371
      if (!seen_dot && !omit_period)
372
372
        {
373
 
          if (result) *result++ = '.'; 
 
373
          if (result) *result++ = '.';
374
374
          extra++;
375
375
        }
376
 
      if(!omit_version_number && !seen_semic) 
 
376
      if(!omit_version_number && !seen_semic)
377
377
        {
378
378
          if(result)
379
379
            {
383
383
          extra += 2;
384
384
        }
385
385
    }
386
 
                    
387
 
  if(result) 
 
386
                   
 
387
  if(result)
388
388
    {
389
389
      *result++ = 0;
390
390
    }